Table of Contents
Last week One of my clients came to me asking for help regarding their website. He was trying to bring an old WordPress website he had to live again. But the problem is when he tried to see or access the WP dashboard, he got an error message saying ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress’. After spending some time I was able to fix the error. So I thought it’s a good idea to share the solution I found with you.
First thing. What causes this missing MySQL extension issue?
The error message is self-explanatory. This error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress, indicates that your server’s PHP lacks the extension required to link your WordPress site to its MySQL database.
First reason: This issue may be caused by older versions of WordPress (below version 3.9) installation. Your website is outdated but your PHP installation on the server is updated to version 7 or higher. Clearly, there is a mismatch. right?
MySQL was deprecated in PHP 7.0 in favor of MySQLi. So, basically, PHP versions above 7 do not have the MySQL extension that older versions of WordPress looking for. In Newer versions, WordPress uses PDO_MySQL or MySQLi extensions.
Second reason: In the other situation, your WordPress is outdated and the PHP version on the server is also outdated. (PHP 5.6 – before the MySQL extension was deprecated). But…
You are actually missing the extension or it is misconfigured.
OK, So now you know what is the reason behind this ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress’ error message. Let’s dive in and see how we can fix it!
How to fix missing MySQL extension error
Find the PHP version installed on your server
First, We need to find out the PHP version installed on our server. You can check on your Cpanel and you may be able to find the necessary information there. But in case you can’t locate where that information is, try the below method.
- Open the code/text editor you prefer. If you can’t find a good one, read this to make the correct choice.
- Create a PHP file and name it phpinfo.php
- Copy the below PHP code, paste it inside phpinfo.php file and save it.
Now we need to upload this file to the root directory of your WordPress site. To the same location, where you can find the wp-config.php file.
If your web hosting offers some kind of file manager tool you can upload the file there. Otherwise, we need an FTP client to do the upload. There are some great free FTP clients you can use. If you don’t have any, installed on your machine, please try the below options.
Once you uploaded the file to the server, open a web browser and go to www.yoursite.com/phpinfo.php. (Don’t forget to replace www.yoursite.com with your domain)
Once you open up the file in a web browser you will be able to see the PHP version on the top of the page. (see the below image). Otherwise, scroll down to the ‘Core‘ section and see the PHP Version.
So, as you can see here on my server, the PHP version is above 7.0. (This is just a local setup to show you the process only). That means, to fix the error, we need to update our WordPress installation to the latest version as PHP versions above 7.0 don’t include that missing extension by default.
At the end of this post, I have included the way to update WordPress installation without accessing the WP Dashboard.
If your PHP version is not above 7.0
If you found the PHP version on the server is not the latest, still using PHP 5.6 or lower, then we must know that the MySQL extension is actually missing or improperly configured.
To know that, scroll down the page and look for the section called MySQL or MySQLi (see the attachment below).
If you have the MySQL extension installed or configured correctly, you will be able to find the version number next to the Client API library version.
If you can’t find MySQL section in the phpinfo.php file, what to do?
Unfortunately, that means the error message ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress‘, is saying the truth. You actually missing the MySQL extension. So, in this case, you need to contact your web hosting company and ask them for help. They will install it for you.
MySQL section appear on the page but still showing the error.
If you could find the section that means it’s installed but configured incorrectly. The php.ini file. Try deleting the file first and see if that fixes the problem. You can locate the file by checking the phpinfo.php file. There’s the pah showing next to the Loaded Configuration File.
So that’s how to solve the error ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress‘.
Finally, I am going to tell you how to upgrade the WordPress installation without accessing the WordPress dashboard. The manual way.
How to manually upgrade WordPress to the latest version
- Go to WordPress.org and download the latest copy of WordPress.
- Extract the zip file to the desktop.
- Delete wp-config-sample.php file which you can find inside the extracted folder.
- Check whether you have a wp-config.php file there. If you have that, need to delete that too.
- Delete the wp-content folder entirely.
- Now open up your FTP client app and connect to your web server.
- Upload all remaining files and folders to the server. Use overwrite method.
That’s it. Please comment below if you still having issues solving this. I will try to leave a reply as soon as possible.