Got an PHP people here to see if they can spot an error with this code?

Soldato
Joined
15 Nov 2003
Posts
14,401
Location
Marlow
I have a PHP script which we use with VBulletin. The script works under PHP 5.3, but when we change to PHP 5.5 the code produces a "database error."

The line it happens on is:-
Code:
$db->connect(
    $config['Database']['dbname'],
    $config['MasterServer']['servername'],
    $config['MasterServer']['port'],
    $config['MasterServer']['username'],
    $config['MasterServer']['password'],
    $config['MasterServer']['usepconnect'],
    $config['SlaveServer']['servername'],
    $config['SlaveServer']['port'],
    $config['SlaveServer']['username'],
    $config['SlaveServer']['password'],
    $config['SlaveServer']['usepconnect'],
    $config['Mysqli']['ini_file']

I'm hoping quite simply that for PHP 5.5 that command needs to be altered in someway?

Thanks for any help...



ps: Preceding that code is the following in case it's important:-
Code:
switch (strtolower($config['Database']['dbtype']))
{
   // load standard MySQL class
   case 'mysql':
   case '':
   {
       $db =& new vB_Database($vbulletin);
       break;
   }

   // load MySQLi class
   case 'mysqli':
   {
       $db =& new vB_Database_MySQLi($vbulletin);
       break;
   }

   // load extended, non MySQL class
   default:
   {
       die('Fatal error: Database class not found');
   }
}
 
Well under PHP5.3 all is OK. Under PHP 5.5 the above line causes my webhost to return an automated database error screen, and I don't think the code continues beyond that point? Any echo or die I do after the statement in question doesn't seem to get done?


In the server logs I can at the time of this error (I've X'd things out):-
Code:
20170310T041357: XXXXXXXXXXXXXXXXXXXXXXXtest.php
PHP Warning:  date() expects parameter 2 to be long, string given in XXXXXXXXXXXXXXXXXXXXXXXx/vbb/includes/class_core.php on line 1129
PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but pl

EDIT: That IS possibly to do with the problem. If I DIE before the line in question, that does NOT appear in the logs!
 
mysql got deprecated. You have to use mysqli or PDO.
Yeh... Sort of cottoned onto something along those lines so made sure for PHP 5.5 I was doing:-

$db =& new vB_Database($vbulletin);

...instead of...

$db =& new vB_Database_MySQLi($vbulletin);



...and thankfully that worked...
 
Back
Top Bottom