The error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” can appear when you are using a PHP version which is incompatible with your scripts version. Meaning your WordPress installation is most likely outdated.
Since the ‘MySQL’ extension is no longer supported from PHP 7.0 and beyond, changing your PHP version to 5.6 or lower will fix the issue. This can be done via your website’s control panel’s PHP Configuration section.
So, let’s do it first and then we will see some probable causes of this error.
Step 1- Login to your Cpanel.
Step 2- Find PHP PEAR Packages and click on it. and then click on show available modules.
Step 3- Find MYSQL and install the 3 extensions shown in the image above.
Step 4- Now Go to select PHP version.
Step 5- Now find MySQL (Use Ctrl + F), select it and save it.
That’s it. The problem is fixed. Let’s get to some probable causes of this error.
Probable causes of this error.
1. PHP’s MySQL extension not installed.
The quickest way to check if your PHP has MySQL support is to put the following code into a file called info.php in your site and access it from a browser.
<? phpinfo(); ?>
A MySQL section like this will be shown.
If it’s not shown there, then you don’t have the PHP’s MySQL extension installed.
In Ubuntu servers and RedHat compatible servers, use the following commands respectivly:
# apt-get install php5-mysqlnd # yum install php-mysql
2. Check if PHP’s MySQL extension directory is misconfigured.
Another cause of the ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress’. could be that the PHP extension directory is not configured properly.
In order to fix this, locate which PHP.ini file is being loaded and ensure that the appropriate “extension_dir” value is being used. So let’s open up the info.php file we created in Step 1 via our web browser.
Look for the line called “Loaded Configuration File”. The file path noted there is the actual location to the PHP configuration file.
Now, look for the entry called “extension_dir“. It should either be commented, or it should have the correct path to PHP extensions. It should never be left blank.
If you are not sure, just comment the line, and restart the web server.
Simply updating PHP and WordPress might also solve the problem.
In case you are running
PHP 5, run the following commands:
apt-get update apt-get install php-mysql
Restart the appropriate service for the changes to take effect.
This may have solved your problem. Feel free to comment below.