Table of Contents
Almost every WordPress error gives you details on what’s gone wrong. This is helpful but does not guarantee you will know how to fix it. “Your PHP installation appears to be missing the MySQL extension, which WordPress requires.” This message has a lot of detail but not much on what to do next.
Like lots of WordPress errors, the answer lies in logging into your server and altering some files. However, unlike many other WordPress errors, you won’t (in most cases) need to touch your core installation files.
In this post, we will show you how to resolve the “Your PHP installation appears to be missing the MySQL extension, which is required by WordPress” error.
What Causes This WordPress PHP Error
If we break down the wording of the error itself, it can give us a clue as to what to do first:
- “Your PHP installation…”: In this case, your PHP installation is your site’s server.
- “…missing the MySQL extension…”: Your server lacks the necessary extension to handle MySQL queries.
- “…required by WordPress…”: Because WordPress uses a MySQL database in most cases, it needs a way to connect to it that doesn’t exist.
WordPress and your database can’t connect because an extension is missing. In most cases, the root cause is down to the following:
- You’re using an old version of PHP, but the extension is missing (as the error message indicates).
- Modern versions of PHP (i.e., 7.0 and above) don’t use the MySQL extension referenced in the error. Because of this, you may see this error with old versions of WordPress.
As such, solving this means checking up on the status of the MySQL extension. Let’s discuss how to do this next.
How to Check Your PHP Version
Before we continue, you should check which version of PHP your server uses. To do this, you’ll need the following:
- A Secure Transfer Protocol Client (SFTP), such as FileZilla, Cyberduck, or Transmit.
- The skills to use SFTP to access your server and WordPress files.
- You need a text editor to create and edit your files (the default on your system is often fine).
Once you have these things in place, open your text editor and paste the following code snippet into a new file:
<?php phpinfo();
Next, save this as phpinfo.php. From here, log into your server and find your root folder. It will usually be the same directory that includes wp-config.php.
Your next step is to upload the phpinfo.php to this directory.
When that process is complete, navigate to the phpinfo.php file through the browser and your current domain (e.g. example.com/phpinfo.php).
This screen will show a lot of different pieces of information. Our focus is on the PHP Version value under the Core section:
If this number begins with “5”, you’ll want to look at our method regarding the MySQL extension. In contrast, if your PHP version starts with “7”, you’ll want to look at our first method in the next section.
Also, remember to delete this file once you’re finished with the fix. You don’t want malicious users to find this information.
Your PHP Installation Appears to Be Missing the MySQL Extension, Which Is Required by WordPress: How to Fix the Error (2 Methods)
Below, we have two methods. One deals with WordPress, while the other deals with the MySQL extension. Let’s start with your WordPress files.
1. Reinstall Some Core WordPress Files
Sometimes, you’ll use an old WordPress version on a modern server running PHP 7 or greater. Before you continue, you’ll want a clean backup of your site and server in case you need to reinstall later.
When you’re ready, you’ll want to download the most recent version of WordPress. Simply head to the WordPress.org website and click the blue Download button:
When you have this in hand, extract the file and delete the following files from the directory:
- wp-config-sample.php.
- wp-config.php (if it’s present in the directory, otherwise skip it).
- The wp-content folder.
After resetting the files, upload them to your server’s WordPress directory, confirming that you’ll want to overwrite any files it detects.
This should fix the issue. From here, you’ll want to log into your WordPress dashboard and update any necessary themes and plugins. Then, take a new backup of your site.
2. Check that the MySQL Extension is Installed and Configured
If you’re running an older version of PHP (we’re talking around version 5), “Your PHP installation appears to be missing the MySQL extension required by WordPress” could be literal. To double check, look at the phpinfo.php file again, under the mysql or mysqli section:
To be specific, look for the Client API library version value and check that there’s a version number:
If the information isn’t there, the MySQL extension is missing. As such, you’ll need to contact your hosting support team for advice and consider scheduling regular maintenance audits. We’d also recommend that you upgrade to a more modern PHP version if possible because old versions are no longer supported.
However, if the extension is installed, you could use a php.ini file on a Linux server (when these files are created for Windows servers). You can find this out under the Configuration File (php.ini) Path value on your phpinfo.php file:
The task here is to back up the php.ini file and then delete it. This should fix the error.
In Summary
“Your PHP installation appears to be missing the MySQL extension required by WordPress” is an informative error, but it might not tell the whole story. In some cases, the problem relates to old versions of PHP rather than a missing extension. In other cases, you may even have incorrect files on your server. Fortunately, the fixes are quick and straightforward regardless.
Are you suffering from the “Your PHP installation appears to be missing the MySQL extension required by WordPress” error? Will this article help? Let us know in the comments section below!