PDA

View Full Version : Errors in server log


RichieBoy67
03-07-2017, 07:02 PM
Seeing many of these.. running php 5.6.30


[Thu Mar 02 23:24:31.397570 2017] [proxy_fcgi:error] [pid 4188:tid 139985248311040] [client ###########] AH01071: Got error 'PHP message: PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/vhosts/#########.com/httpdocs/global.php(29) : eval()'d code on line 274\nPHP message: PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/vhosts/#######.com/httpdocs/global.php(29) : eval()'d code on line 336\n', referer: https://#########.com/showthread.php?t=236793&page=11

i know it is a plug in but I could use help tracking it down..

Thanks:up:

Dave
03-07-2017, 07:51 PM
Check for a "global_start" hook.
Looks like the hook you're looking for has a couple hundred lines of code in it.

RichieBoy67
03-07-2017, 08:00 PM
Thanks, That makes sense Dave.

It has to be one of the following plug ins then. Any thoughts?

Dave
03-07-2017, 08:12 PM
Hard to tell, open each of them and see which one contains the function "mysql_connect".

RichieBoy67
03-07-2017, 08:33 PM
Thanks Dave,

I believe it is Photopost.. Still looking though.

Anything wrong with this?

$dblink = mysql_connect ("$vbhost", "$vbuser", "$vbpass") or die('I cannot connect to the database.');
mysql_select_db ("$dbname2")or die("Could not select forum database");

Dave
03-07-2017, 08:35 PM
Yes, that's what makes use of the mysql_* functions which is deprecated in your PHP version.
You can fairly easy change it to make use of the mysqli_* functions though: https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html

RichieBoy67
03-07-2017, 08:39 PM
Oh yeah, I see what you mean now...

Like this..

$connection = mysqli_connect( 'host', 'username', 'password'); or die('I cannot connect to the database.');

ok, I got you. Thanks Dave

##The full replacement would be:

$connection = mysqli_connect( 'host', 'username', 'password'); or die('I cannot connect to the database.');

mysqli_select_db( $link, $database) or die("Could not select forum database");
}

Dave
03-07-2017, 09:37 PM
You can change it to
$connection = mysqli_connect( 'host', 'username', 'password', 'database');
to make it easier.

I assume that it also makes use of other mysql_* functions, I would double check that.
To port a mysql_query to mysqli_query, you need to specify the connection variable as the first argument and the second argument will be the actual query.

RichieBoy67
03-07-2017, 10:26 PM
Thanks!

The only other ones are $vbhost, $vbuser, $vbpass, $dbname and they should not hard to convert. :)

Paul M
03-08-2017, 05:13 PM
A product or plugin should never be using native MySQL or MySQLi functions to connect to the database (or for subsequent commands), it should be using the vbulletin database object.