Sometimes, when loading your WordPress website, the “your PHP installation appears to be missing the MySQL extension which is required by WordPress” error might pop up.
This error is typically caused by a nonexistent MySQL extension, outdated WordPress software, or an old PHP version.
Luckily, the missing MySQL extension error is easy to solve. In this article, we’ll explore its causes and walk you through the four methods to fix the error.
Error code | Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress |
Error type | Server-side error |
Error causes | Missing MySQL extension Outdated WordPress version Using PHP 5.6 or lower |
What Causes the “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress.” Error
This error occurs when your server’s PHP can’t connect your WordPress site to the MySQL database. As a result, you get an error message instead.
There are several possible causes of the said problem, namely:
Missing MySQL Extension
Not having the correct WordPress MySQL extension is one of the most common causes of this error.
The MySQL extension was deprecated from PHP 7.0 and above in favor of MySQLi extensions and PDO_MySQL. Therefore, if you’re using a modern PHP version, you may have an outdated MySQL extension.
You can find out your PHP version in your control panel. For Hostinger users, open hPanel, and check your PHP configuration information there.
Outdated WordPress Version
You may also face this error if you’re using an outdated version of WordPress with PHP 7.0 and above. Since the modern PHP version deprecated the MySQL extension, WordPress will not find the extension it’s looking for.
Using PHP 5.6 or Lower
The 5.6 and lower PHP versions may not have deprecated the MySQL extension yet, but rather, your current PHP version may not be configured properly. As a result, WordPress is unable to connect to the necessary extension.
How to Fix “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress.”
After figuring out the cause of this issue, the next step is to fix it.
In this section, we’ll explore the four ways to repair the problem.
1. Check If the MySQL Extension Is Enabled
If you’re using PHP 5.6 or lower, you need to check whether the MySQL extension has been installed. Do this by uploading a phpinfo.php file into your browser.
To do so, follow the steps below:
- Sign in to your hosting account via File Transfer Protocol (FTP) like FileZilla or access Hostinger’s File Manager from hPanel.
- Open the public_html folder to access the root directory of your WordPress site.
- Create a new file and name it phpinfo.php.
- Edit the file by adding the following code snippet:
<?php
phpinfo();
?>
- To load this file into a browser, add /phpinfo.php after your website’s URL. For instance, example.com/phpinfo.php. Once it loads, the page will show you a list of your website’s PHP settings.
For this issue, look for the row named the Client API version.
If you can’t find it, that means the extension is not installed.
To fix that, contact your hosting provider and ask them to install the extension for you. Hostinger users can easily manage their PHP extensions via hPanel.
Alternatively, update your PHP version so that the extension is unnecessary.
2. Make Sure the PHP Extension Is Properly Configured
Once you’re sure that the PHP extension is installed, the next step is to check whether it’s properly configured.
One of the main causes of PHP configuration problems is that you’re uploading the wrong php.ini file or it has an incorrect file path. This can happen when you’re uploading a file that’s intended for Windows when you’re using a Linux server or vice versa.
You can find this information in the Loaded Configuration File row in the phpinfo.php file you have uploaded before.
First, don’t forget to create a backup of this file by downloading it to your computer. After, delete the php.ini file and check whether this fixes the problem.
3. Check the PHP Version You’re Using
To change your PHP version, go to the Tools → Site Health menu on your WordPress dashboard.
Choose the Info tab. Scroll down and expand the Server option. You can see the PHP version you’re currently using under this section.
Another option is to use the phpinfo.php file you uploaded earlier. Scroll to the Core section and look for the PHP Version row.
If your PHP version starts with the number 7, you might need to update the WordPress software. However, if the version starts with 5, you may be missing the MySQL extension instead.
4. Update the WordPress Core Software
If your current version of PHP is already above 7, this problem might be caused by an outdated WordPress installation instead. Version 3.9 or lower can prompt this error.
We recommend updating the WordPress software to the most recent version. Aside from fixing this problem, doing so also comes with other benefits for your WordPress sites, such as security and performance improvements.
Important! Make sure to back up your website before proceeding with the WordPress software update.
To update the core software manually, go to WordPress.org and download the latest WordPress installation version.
Then, extract the zip file into your computer. Open the folder that contains all the WordPress files and delete the following ones:
- wp-config-sample.php file
- wp-content folder
- wp-config.php file
If you can’t find some of these among your existing files, proceed to delete the ones you see in the installation folder.
After that, upload the rest of the files and folders to your server via FTP. In case you see an error message about duplicate files, choose the Overwrite option.
Once everything is uploaded, your WordPress website should work properly.
Conclusion
In this article, we have figured out the causes for the “your PHP installation appears to be missing the MySQL extension which is required by WordPress” error, which are a missing MySQL extension, an outdated WordPress version, or an older version of PHP.
We’ve also covered the four ways you can fix this issue, namely:
- Checking if the MySQL extension is enabled
- Making sure that the PHP extension is properly configured
- Checking the current version of PHP you’re using
- Updating the WordPress core software
If you still have any questions about the PHP or MySQL extension error, feel free to drop them in the comments section. Don’t forget to check out our other tutorials to improve your WordPress site.