Trying to install WordPress or visit your WordPress site only to encounter an error that says “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”?
As with any WordPress error message, it can be frustrating to encounter a problem that prevents you from using/accessing your WordPress site.
However, don’t despair!
Generally, this error means that something is going wrong with the code on your site and something is preventing WordPress from being able to connect to its MySQL database.
In this article, we’ll go over what that “something” might be and share some tips on how to troubleshoot and fix this error message.
What Causes the WordPress Missing MySQL Extension Error?
As we mentioned in the introduction, the error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” steps from some issue with the code/scripts on your server.
There are two main reasons why this might be the case:
1. You’re Using an Outdated Version of WordPress with PHP 7+
If you’re using a very old version of WordPress with a modern version of PHP, you might encounter this error because PHP 7.0 deprecated the MySQL extension in favor of MySQLi. That is, PHP 7+ no longer includes the MySQL extension that WordPress is looking for.
Modern versions of WordPress will instead use the newer PDO_MySQL or MySQLi extensions. However, older versions of WordPress (below version 3.9) might cause this problem.
2. You’re Using PHP 5.6 or Lower but the Extension Is Missing or Improperly Configured
The other likely cause is that you are using PHP 5.6 (before the MySQL extension was deprecated), but the extension is either missing or improperly configured.
How to Fix “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”
Now that you know what’s going on, let’s go over some tips for how to troubleshoot and fix the issue.
1. Check What Version of PHP You’re Using
The first step to diagnose this issue is to figure out which version of PHP your WordPress site’s server is running. The answer to this question will dictate the next steps that you take.
If your host is using cPanel, you can use the cPanel File Manager tool.
Once you’ve connected to your server, create a new file called phpinfo.php in the root directory of your WordPress site. This should be the same folder that contains your wp-config.php file.
Then, edit the file and add the following code snippet:
Once you save the file (and re-upload the saved version if needed), navigate to yoursite.com/phpinfo.php, making sure to replace yoursite.com with your actual domain name.
You should see a screen that displays a lot of different information about the PHP configuration on your server. Scroll down to the Core section and look for the PHP Version item. Pay attention to the numbers – you should see something like x.x.x. E.g. 7.2.25 or 5.6.8:
If your PHP version starts with a “7”, that usually means that you need to update the WordPress software. On the other hand, if you’re still using PHP 5.X, you might be missing the MySQL extension.
Note – at Kinsta, we strongly recommend using the latest version of PHP. In fact, we don’t support versions below PHP 7.2. These older versions have slower performance and, because they no longer receive security updates, could pose a security risk to your site.
Learn more about why it’s important to use modern, supported PHP versions.
2. Update the Core WordPress Software
If your server is using PHP 7+, the most likely cause of this error is that you’re running an old version of WordPress. If you’re using WordPress version 3.9 or lower, that can trigger this error.
Therefore, the fix is to update your WordPress software, which will also come with lots of other feature, security, and performance improvements.
Once you’ve downloaded it, extract the zip file to your computer. Then, open the folder that contains all of the WordPress files and delete the following items:
- The wp-config-sample.php file.
- The wp-config.php file (you might not see this file – just make sure to delete it if it’s there).
- The wp-content folder.
Once you’ve deleted those items, upload the remaining files/folders to your server via FTP. When prompted about duplicate files by your FTP client, tell it to overwrite all files:
Once the file uploads finish, your WordPress site should be running the most recent version and your issue should be fixed.
As a follow-up step, you should also make sure to update all of your plugins and themes to the latest versions as well. You can follow these guides:
3. Check to See If the MySQL Extension Is Installed
If your server is still using PHP 5.6 or lower, your server might be missing the MySQL extension that WordPress requires.
To check if this is the case, go back to the phpinfo.php file that you uploaded to your server in Step #1.
Look for a section named either mysql or mysqli.
If the MySQL extension is installed, you should see a version number next to the Client API library version item:
If you can’t find this information, that means the MySQL extension is not installed. The best solution is usually to reach out to your host’s support staff and ask them to install it for you.
Unless you absolutely must continue using PHP 5.6 or lower, a much better solution is to upgrade your server to PHP 7.2+ instead of putting time into properly configuring an older version of PHP. You can follow our guide on how to update the PHP version of your WordPress site.
4. Make Sure PHP Extension Is Configured Properly
If you’re using PHP 5.6 or lower and the extension is installed, the issue might be that it’s not configured properly. Two common issues are:
- Uploading a php.ini file that’s intended for Windows servers when you’re using a Linux server
- Incorrect file paths.
You can find the location of your php.ini file in the phpinfo.php file that you created before:
First, we recommend backing up the existing file by downloading it to your local computer. Then, try deleting the php.ini file and see if that fixes the problem.
The “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” message is a frustrating error to encounter because it seems so technical.
However, with the steps in this article, you should be able to diagnose and fix the issue.
Our recommended solution is to make sure you’re using the most recent versions of both PHP and WordPress.
If you use PHP 7.2+ and WordPress 5.0+, you should be able to automatically fix this error and get your site working again, while also benefiting from all of the other performance, security, and feature enhancements that come from updating.
If you enjoyed this tutorial, then you’ll love our support. All Kinsta’s hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans