SOLVED PHP installation appears to be missing the MySQL extension

audrey

Well-Known Member
Oct 18, 2006
94
4
158
Hi

If I use PHP Version 7.2.17 on a WordPress site - I get the following error:

"Your PHP installation appears to be missing the MySQL extension which is required by WordPress."

My cpanel server has PHP Version 7.2.17 installed.
(also has PHP 5.6, 7.0 and 7.1 installed but only Version 7.2.17 is the problem)

WHM is Version 78.0.20

I am wondering what "yum" command I should use to install the necessary
MySQL extension on PHP Version 7.2.17

PHP info for Version 7.2.17 does not show MySql

it does say
Loaded Configuration File /opt/cpanel/ea-php72/root/etc/php.ini
extension_dir /opt/cpanel/ea-php72/root/usr/lib64/php/modules

Thanks for your help

Audrey
 

martin MHC

Well-Known Member
Sep 14, 2016
154
25
28
UK
cPanel Access Level
Root Administrator
What version of WordPress are you using?
Wordpress version is not important.

MySQL should already be installed on your WHM server. What you will need is the PHP libraries/extensions to interact with MySQL.

@audrey so what you do is if you have Easy Apache 4 installed in your WHM you use that system to add MySQL. Please review the EA4 documentation for how to use it, basically you have a bunch of options and you simply need to update your choices and add the MySQL options.


Another option is to install MySQL via YUM and you can do that via the MySQL documentation. Yum is available from the WHM Terminal or SSH on your server.
 

audrey

Well-Known Member
Oct 18, 2006
94
4
158
as stated in my post - I want to use yum
Just looking for the correct yum command

Is this the correct yum command to install th emysql extension on PHP Version 7.2.17 ?

yum install php72w-mysql
 

martin MHC

Well-Known Member
Sep 14, 2016
154
25
28
UK
cPanel Access Level
Root Administrator
Is this the correct yum command to install th emysql extension on PHP Version 7.2.17 ?

yum install php72w-mysql
I believe this may work;

However, I have found

Code:
yum install php-mysql
and

Code:
yum install php-mysqli
Both of these should possibly be run before trying more specific modules.

source serverfault.com/a/874365
 
Last edited by a moderator:

sparek-3

Well-Known Member
Aug 10, 2002
1,929
178
343
cPanel Access Level
Root Administrator
With respect, please can you explain how WordPress versions effect MySQL installs? Thanks.
Extremely old versions of WordPress rely on the mysql_connect() function in PHP. mysql_connect() was deprecated in PHP 5.5 and removed in PHP 7.0.

If the user is using PHP 7.0+ and using a script that relies on mysql_connect() then it won't work. Older versions of WordPress that rely on mysql_connect() generate this particular error message verbatim when run on a PHP 7.0+ system.
 

audrey

Well-Known Member
Oct 18, 2006
94
4
158
Thanks - but - none of these commands worked to solve the error
yum install php72w-mysql
yum install php-mysql
yum install php-mysqli


this command solved the error
yum install ea-php*-mysql*
 

martin MHC

Well-Known Member
Sep 14, 2016
154
25
28
UK
cPanel Access Level
Root Administrator
Extremely old versions of WordPress rely on the mysql_connect() function in PHP. mysql_connect() was deprecated in PHP 5.5 and removed in PHP 7.0.

If the user is using PHP 7.0+ and using a script that relies on mysql_connect() then it won't work. Older versions of WordPress that rely on mysql_connect() generate this particular error message verbatim when run on a PHP 7.0+ system.
@sparek-3 thanks, I thought this could be the only likely relationship between MySQL and WordPress, and I had considered this, initially, but OP states that versions with PHP 7.0 and PHP 7.1 did not have this problem, therefore this issue was to do with the PHP version installed rather than the system running on the PHP.

Cheers
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @audrey,

Can you try installing the mysqlnd RPM for each PHP version you are using to see if it helps solve the issue? EX:

Code:
yum install ea-php56-php-mysqlnd
yum install ea-php70-php-mysqlnd
yum install ea-php72-php-mysqlnd
Thank you.
 

audrey

Well-Known Member
Oct 18, 2006
94
4
158
Hi Michael

Thanks for your help.

As posted above (there is so much other info it is easy to miss)
I was able to solve the error using the
this command
yum install ea-php*-mysql*

So need to try your suggestions - but- I will keep the yum commands that you provided in my files if I need them in the future

Take care
Audrey
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
I was able to solve the error using the
this command
yum install ea-php*-mysql*

So need to try your suggestions - but- I will keep the yum commands that you provided in my files if I need them in the future
Hello @audrey,

The wildcards (*) in the command you used would have installed the ea-php$$-php-mysqlnd packages. I'm glad to see the issue is now solved. Thanks for sharing the outcome.