Article read time - 5 minutes

Almost every WordPress error gives you details on what’s gone wrong. This is helpful, but there’s no guarantee that you will know how to fix it. “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” is a message with 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 lots of other WordPress errors, you won’t (in most cases) need to touch your core installation files.

In this post, we’re going to 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 doesn’t have a necessary extension that handles 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.

To summarize, WordPress and your database can’t connect because there’s an extension 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 per the error message).
  • 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 a process of 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:

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.

stfp client

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).

php info

This screen will show a lot of different pieces of information. Our focus is on the PHP Version value under the Core section:

php core info

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, as you don’t want this information to lie in wait for malicious users to find.

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

In some cases, you’ll be using an old version of WordPress on a modern server running PHP 7 or greater. Before you continue, you’ll want a current, clean backup of your site and server in case you need to reinstall at a later date.

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:

wordpress download

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.

With the reset of 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, and from here you’ll want to log into your WordPress dashboard and update any themes and plugins that need it. 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 which is required by WordPress” could be literal. To double check, look at the phpinfo.php file again, under the mysql or mysqli section:

php mysqli

To be specific, look for the Client API library version value, and check that there’s a version number:

client version

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 think about 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, it could be that you’re using 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:

file path

The task here is to back the php.ini file up, then delete it. This should fix the error.

In Summary

“Your PHP installation appears to be missing the MySQL extension which is required by WordPress” is an informative error, but it might not tell the full 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 with the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error, and will this article help? Let us know in the comments section below!

wordpress support plans

Leave a Reply
Comment policy: We value comments and the time that visitors to our blog spend to give feedback. Please note that all comments are manually moderated and any deemed to be spam or promotional will be deleted.