Categories: Troubleshooting

Fix: Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress

You load your WordPress site, and you receive the following error: “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” This message can be alarming.

Don’t panic. Your website is still there; it just can’t be accessed. You may just need to update WordPress, update/reinstall PHP, or fix your PHP configuration to fix the error.

The most common cause of a MySQL extension error is an out-of-date WordPress or PHP installation. Luckily, you can fix the error by updating WordPress, updating PHP/MySQL, or changing your PHP configuration.

Below, we’ll explain why this WordPress error can happen and outline the three most effective fixes. Let’s get started!

The Causes of the Missing MySQL Extension Error

The MySQL extension error means that PHP doesn’t know how to ‘talk’ to MySQL. In WordPress, PHP (a programming language) controls the way your site displays. MySQL (a database) contains the data that drives the website.

Without MySQL, PHP may know how to display the title of a page, but it won’t know what the title of the page is. Likewise, it might be able to display a post, but it won’t have a record of any of the posts on your website.

If you’re receiving a MySQL extension error suddenly, it’s likely that you just haven’t updated your WordPress installation recently. However, if you see the message directly after installing WordPress, it’s more likely that your services weren’t installed correctly or the extension wasn’t properly configured.

How to Fix the “Your PHP Installation Seems to be Missing the MySQL Extension” Error (3 Methods)

Before you start troubleshooting, it’s important to know your WordPress and PHP versions. You can usually check your WordPress version by logging into the dashboard and heading to Updates:

Above, you can see that it says, “You have the latest version of WordPress.” If you need to upgrade the WordPress core software, there should be a button that says: “Install version x.x.x” (where x.x.x is the current version).

However, if you can’t reach your WordPress dashboard, you’ll need to access it via File Transfer Protocol (FTP). For example, you could use FileZilla to log into your server.

Then, download a file called version.php that appears in the base directory of your WordPress installation:

In the above version.php file, you can see that the $wp_version is 5.9 alpha.

Next, you’ll need to know your PHP version. There are a few methods you can use to find your PHP version, but we’ll be using PHPINFO().

To find out your PHP version, you must first call the PHPINFO() function. You do this by saving a file called phpinfo.php with the following text:

<?PHP
   phpinfo();
?>

When you upload this file to your server and run it, you will see the following information:

Above, you can see that the PHP version is PHP Version 5.5.9-1ubuntu4.13.

You might like to check to see the current WordPress requirements. As of November 2021, they are:

  • PHP 7.4+
  • MySQL 5.6+
  • HTTPS

In the above example, you would need to update PHP to 7.4 or later to meet the recommended requirements.

It’s easier to find this information on some servers. For example, if you have the cPanel software in your hosting panel, you’ll see a listing of PHP and MySQL services on the left-hand side. However, the FTP method should work for any hosting service.

Now that you know which version of WordPress and PHP you have installed, you can start fixing your problem. Let’s look at three possible solutions!

1. Update WordPress to the Most Recent Version

The most common reason that you receive the MySQL extension error is that WordPress is not up-to-date. If you checked your WordPress version earlier and found that it isn’t the most recent software, you will have to update it manually through FTP.

First, you need to download the latest version of WordPress from WordPress.org:

Your computer will download the software in a file. You will need to upload this to your hosting account through an FTP client such as FileZilla:

Manually updating your WordPress files will delete the files that already exist. Therefore, you should follow these steps:

  1. Back up all your WordPress files first by using FileZilla to download them.
  2. Extract the WordPress files that you downloaded from WordPress.org.
  3. Replace your existing WordPress files with the new ones by using FileZilla to upload and replace them.

Once you have completed the above steps, you should be able to log into your site as normal. If you can’t, then another issue is causing the MySQL extension error. Once you’re done, you may also want to enable automatic updates so that a similar problem doesn’t occur again.

2. Upgrade or Reinstall PHP

If your PHP version is 5.6 or older, it may be too outdated to connect to the current version of MySQL. All you need to do is upgrade it to get the appropriate MySQL extension. However, you don’t need to reinstall MySQL — that isn’t generally the cause of the MySQL extension error.

How you upgrade or reinstall PHP will depend on your hosting service. For example, in BlueHost, you would use the MultiPHP Manager utility called Bluerock, seen below:

In DreamHost, you would log into your DreamHost Panel and click on Manage Websites > Manage > Modify PHP:

Because this process varies, you might need to contact technical support for your hosting account. The support agent will either be able to walk you through the process of upgrading PHP or even do it for you.

Be aware: if you’ve customized your WordPress site with your own PHP — and that PHP was a much older version — you may still get errors after updating it. This situation is normal because PHP doesn’t support all of its legacy features. Therefore, you’ll just need to update the program to the newest version.

However, if your PHP version is already above 5.6, you may need to uninstall it and reinstall it instead.

3. Reconfigure Your PHP Installation

If you’ve updated WordPress and PHP and you’re still experiencing the error, there may be a configuration issue. PHP’s configuration settings are stored in a file called php.ini. You can use this file to do things such as increase the maximum file upload size for your website. 

However, the php.ini file may be in a different location depending on your installation. To locate it, you will need to call the PHPINFO() function as you did before.

Just as the PHPINFO() function lists the current version of PHP, it will also show the location of your php.ini file. It should look something like this:

/etc/php5/fpm/php.ini

Delete this file and restart your server per your hosting service’s directions. The next time PHP runs, it will create a new php.ini file with the default configuration.

If you’ve tried the three methods listed above, your MySQL extension error should be resolved. If your WordPress site is still throwing the message, you might need to contact your hosting provider’s technical support team for more assistance.

Conclusion

While it may be concerning to see your WordPress website replaced by an error message, this problem is one of the easiest to fix. In most situations, it’s really just a matter of keeping your site updated. If you don’t have the most recent version of WordPress, PHP, and MySQL, your website may not work properly.

You can try these methods to fix the “Your PHP installation appears to be missing the MySQL extension” error:

  1. Update your WordPress installation.
  2. Update your PHP version.
  3. Reset your PHP configuration.

It’s always best to use the most current versions of WordPress and PHP — not only to avoid errors but also for enhanced security and protection. If none of the above solutions work, you may be dealing with a different database error.

Have you found a different solution? If you’re still experiencing problems with your WordPress installation, or if you’ve found a different answer, let us know in the comments section below!

Will Morris

Recent Posts

How to Reset WordPress: Step-by-Step Guide for Beginners

Are you looking to reset a WordPress site and start fresh? Reset a WordPress Site…

5 days ago

WordPress vs. Wix: Which Platform Is Right for You?

Ready to build your online presence? Choosing the right platform between Wix vs. WordPress is a crucial first…

5 days ago

How to Change Favicon in WordPress: A Step-by-Step Guide

Changing your favicon in WordPress is a small yet powerful way to improve your website’s…

5 days ago

How to Embed a PDF in WordPress

Have you been searching for the easiest way to share PDF files directly on your…

1 week ago

How to Add Social Media Icons to WordPress Header: A Complete Step-by-Step Guide

Ever notice how professional websites seamlessly display social media icons in their headers? Adding social…

1 week ago

How to Clear Cache on WordPress: A Step-by-Step Guide

WordPress caching is an incredible tool for boosting your website’s performance. It helps deliver faster…

1 week ago