New client needs mysql_* in 5.6 to function briefly

Operating System & Version
CentOS v7.9.2009
cPanel & WHM Version
cPanel & WHM v102.0.21

ttremain

Well-Known Member
Feb 16, 2003
279
6
168
cPanel Access Level
Root Administrator
I know, the new client is in the process of moving to PDO, BUT is being forced by web host to migrate to new VPS prior to PDO completion.

I just got pulled into this today. I put PHP 5.6 on the new server but the mysql library seems not to be installed.

Site is getting Fatal error: Call to undefined function mysql_connect()

No comments about "switch to PDO" please. The client has already been working on this and we will complete it as soon as we can get the site at least limping along on the new VPS.

Please advise.
 

Attachments

Last edited by a moderator:

andrew.n

Well-Known Member
Jun 9, 2020
965
358
63
EU
cPanel Access Level
Root Administrator
Does the server have CloudLinux? Have you checked EasyApache 4 configuration in WHM to see if PDO PHP extension is installed?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,163
2,410
363
cPanel Access Level
Root Administrator
This is going to be up to the code of the site. More details on that can be found here, and as much as I don't like Stack Overflow links for clients, there are good details in this one:


It's also possible there could be .htaccess entries that aren't compatible, as outlined here:

 

mtindor

Well-Known Member
Sep 14, 2004
1,497
130
193
inside a catfish
cPanel Access Level
Root Administrator
The site owner is migrating to PDO, but it's not done yet. PHP 5.6 on this new box doesn't seem to have support for mysql_*
Sounds like you need to contact your web host. If you are the web host, you need to make sure the appropriate mysql extension is enabled. Andrew asked you before if your server was running CloudLinux. Instead of answering him you were giving him attitude.

If the server is running CloudLinux with alt-php, then log into the cPanel interface, navigate to Select PHP Version, set the PHP version that you want to use and click on "set as current". Then click on the appropriate mysql* or md_mysql* extensions you need enabled as well as the PDO extensions that you need enabled. For instance, if I log into one of my accounts (CloudLInux + alt-php and using PHP 5.6) and do this, I have the following checkmarked:

mysql
mysqli
pdo
pdo_mysql
pdo_sqlite

If your server is not running CloudLinux + alt-php, then you'll have to troubleshoot further to make sure you have the appropriate mysql extensions installed.