SOLVED MySQL error when using non default PHP version

PatrickVeenstra

Well-Known Member
Feb 12, 2012
171
6
68
Barcelona
cPanel Access Level
Root Administrator
My server's default PHP version is 5.6 when I try to use 7.1 it works fine except on one subdomain that returns:
PHP Warning: mysqli::mysqli(): Headers and client library minor version mismatch. Headers:50558 Library:50640

As EA compiles the libraries I suppose it has been done correctly. Also I don't get this error on other subdomains. Note that this specific subdomain has some old code that does not use OOP (I believe all other code does).

This specific line *for example* triggers the error:
if ([email protected]_connect($TBDEV['mysql_host'], $TBDEV['mysql_user'], $TBDEV['mysql_pass']))
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Hello @PatrickVeenstra,

Can you check to see if that subdomain's document root includes a custom php.ini file? If so, can you try moving it out of the way and verifying if the issue persists (you may need to clear your browser cache before refreshing the page to test)?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Hello,

To update, here's the response from the support ticket noting the cause of the issue:

I was able to determine the cause of the issue by tailing the Apache error log and doing a quick search for the error (Call to undefined function mysql_connect):

================================
# tail -n0 -f /var/log/apache2/error_log
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/username123/public_sub/torrent/test.php:4
Stack trace:
#0 {main}
thrown in /home/username123/public_sub/torrent/test.php on line 4
================================

This lead me to find this user submitted forums answer on Stack Overflow:

https://stackoverflow.com/a/37877644

================================
In case, you are using PHP7 already, the formerly deprecated functions mysql_* were removed entirely, so you should update your code using the PDO-functions or mysqli_* functions instead.
Thank you.