Jump to content

PHP Script works on some servers and not others - :-(


Recommended Posts

Hi All,

 

I have a script (large) sold to us with no chance of support.

 

It works fine on on a commercial hosting, works fine on my CentOs Box at home spritz's out on another commercial server, The ht,l/Java runs but the php seems to displays on the page (from half wat through).

Other PHP runs fine on this site.

 

I've pulled PHPinfo on all and wondering if someone could suggest which server config values i should be comparing for this type of Fault.

 

This is the script

http://accelerate.info/searchpro/install.php

 

This is the servers phpinfo.php

http://accelerate.info/searchpro/phpinfo.php

 

This is the php code just before it outputs to page with the next red part

being where it starts to output to page

 

<tr><td bgcolor="#284465"><img src="img/head_li.gif" alt="" width="29" height="25"><img src="img/i18n/<?php echo $timg; ?>.gif" alt="" width="150" height="25"></td></tr>

<tr><td><!-- content --><?

if (!$installed) {

    if ($_GET['step'] == 1) {

        $step_complite = false;

        if (isset($_POST['submit'])) {

            $connect_db = @mysql_connect($_POST['db_host'], $_POST['db_login'], $_POST['db_passwd']);

            $select_db = @mysql_select_db($_POST['db_name'], $connect_db);

            if (!$connect_db) $error_msg = $i18n['install']['error_db'];

            elseif (!$select_db) $error_msg = $i18n['install']['error_db_select'];

 

            if (!$error_msg) $step_complite = 1;

        } else {

            $_POST = array("db_host"=>"localhost","db_login"=>"","db_passwd"=>"","db_name"=>"");

        }

        if ($step_complite) {

            $_SESSION['step'] = 1;

           

            umask(0777);

 

            /** set chmod to folders */

            chmod(SSP_DIR.'/data', 0777);

            chmod(SSP_DIR.'/img',  0777);

            chmod(SSP_DIR.'/img/buttons',  0777);

 

Link to comment
Share on other sites

The code most likely is using short open tags <? and <?=, which was another blunder by php. Who would make multiple different tags the define what php code IS, then make some of them optional/conditional with the ability to turn them off.

 

Php.net itself points out - "It's been recommended for several years that you not use the short tag "short cut" and instead to use the full <?php and ?> tag combination." and that short open tags not be used in code that is intended to be distributed (i.e. sold or posted for others to use) because it results in code that is not portable between different server configurations.

 

I would recommend that you take a few minutes with a programing editor and do a search/replace on all the <? and <?= and convert them to <?php and <?php echo so that the code will work on all server configurations.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.