Moving to a new server, script seems to connect to database but a blank page

This is more or less a general question, Are there any particular or common reasons why a script would appear to connect to the database, however show a blank page upon logging in? This is a custom script written by the developer before me. I’ve been migrating our websites to a new dedicated server and am having some issues with this script. Works fine on old server, replaced database and modified the config file to reflect the new server/database however when I login, it just shoots me to the correct page, however the page is blank.

I know it is connecting to the database, because I attempted to connect with a false username/password and it came back as invalid.

I haven’t switched name servers yet, so I am developing on the IP address. For anyone that has experienced an issue similar to this, would you mind pointing me in the right direction?

I know this is a pretty bland and without code examples may be impossible to tell. I’m more or less just looking for similar problems, or common problems with these types of errors. I’d be more than happy to provide source code, or even the site IP to anyone willing to help via PM.

I’ve dug deep myself, and can’t seem to figure this one out. Hoping you guys can help!

Thank you for any help!

Ah, the white screen of death (WSOD)!

Usually means that there is an error, but php doesn’t display it. Normally the error will be logged in the log file, have you checked that yet?

Also, you can try to put this in your script


<?php
ini_set('display_errors', true);
error_reporting(-1);

Thanks a lot for your response. Can’t believe I didn’t think to do error_reporting in the first place. Here is what I have been told:

Deprecated: Function ereg() is deprecated in  /var/www/vhosts/legacysafeguard.net/httpdocs/recruiting/includes/configure.php  on line 2              Notice: A session had already been started - ignoring session_start() in   /var/www/vhosts/legacysafeguard.net/httpdocs/recruiting/includes/application-header.php  on line 34  Notice: Undefined index: admin_name in  /var/www/vhosts/legacysafeguard.net/httpdocs/recruiting/includes/application-header.php  on line 38  Notice: Undefined index: mktid in  /var/www/vhosts/legacysafeguard.net/httpdocs/recruiting/index.php on  line 12  Notice: Use of undefined constant path - assumed 'path' in  /var/www/vhosts/legacysafeguard.net/httpdocs/recruiting/index.php on 

Looking into this further at the moment. Thanks for any help!

Looks as if a part of the script is trying to access the actual domain version. Am I right? Because this is hosted on the new server, via ip address so somewhere in the script this guy has this set?


<?php
if ( ereg( '192.168.0.61', $_SERVER['SERVER_ADDR'] ) )
{
    define( 'HTTP_SERVER', 'http://192.168.0.61/legacy' );

    define( 'DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT'] . "/legacy/web" );    
}

 //define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']);
 //echo $_SERVER['SERVER_NAME'];
 
if($_SERVER['SERVER_NAME']=='www.legacysafeguard.net' || $_SERVER['SERVER_NAME']=='legacysafeguard.net'){

define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']."/recruiting"); 
}else{
 
define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']); 

}
 //echo DOCUMENT_ROOT;
/*else
{
    define('HTTP_SERVER', 'http://servh7yohzu4.sn.sourcedns.com/~chinmay');
    define('DOCUMENT_ROOT', "/home2/chinmay/public_html");
}*/

//define( 'TO_MAIL', 'sprince@myifirm.com' );
//define( 'MAIL', 'sprince@myifirm.com' );
?>

Assuming this is where my problem is located?

ereg is superseded by preg_match. You will need to rewrite the expression to make it work though, since preg_match uses a different regular expression variant (PCRE) than ereg did (POSIX).

ereg for string comparison. talking about overkill :slight_smile:

Replace if (ereg( '192.168.0.61', $_SERVER['SERVER_ADDR'] )] with if (isset($_SERVER['SERVER_ADDR']) && '192.168.0.61' == $_SERVER['SERVER_ADDR'])) and you should be fine.

Thanks a ton. Would you happen to know of any documentation or helpful article that would help me get in the right direction? If not, I do know of a wonderful tool called Google. But I thought I would ask, hehe!

Thanks a ton for all your help.

Scratch That: You already did!!! Thanks sir!!

LOL, you’re welcome :slight_smile: