Fortunately, WordPress errors aren’t a regular occurrence for most users. For those that do crop up regularly, there’s usually a fix to be found. However, if you come across Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress, you may be scratching your head for a while.

This is because there is no obvious repair you can make based on the error. What’s more, everything else may seem fine on your site in some cases. The good news is that solving this problem could take minutes at most.

This post will look at the ‘missing MySQL Extension’ error, discuss why it appears, and more importantly, show you how to fix it.

What the Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress Error Is

As WordPress errors go, Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress is the biggest mouthful of them all. It’s something you’ll notice upon logging into the WordPress dashboard in most cases, and it isn’t something you’ll immediately understand.

Essentially, it means the PHP code that runs WordPress on your server is missing a vital part. Alternatively, the MySQL extension could be present, but your server’s PHP version might not be able to tell from reading the code on your site.

For the uninitiated, your WordPress database contains practically everything on your site. The Content Management System (CMS) shuttles data to and from your database in perpetuity – MySQL is the type of database WordPress runs on.

Why the …MySQL Extension… Error Occurs

Putting everything together, you start to see the real issue. In layman’s terms, the server doesn’t know how to talk to your database, because something is missing, or incompatible. Usually, this happens for two reasons:

  • Your server’s PHP version needs updating. If your server is running PHP 5.6 or lower, this could cause the error to crop up.
  • Your server is running a modern PHP version (7.0+), but you’re running a very old version of WordPress.

In any case, once your server and WordPress align, all will be right with the world.

What You’ll Need to Fix the …MySQL Extension… Error

In order to fix the missing MySQL extension error, you shouldn’t need much more than your site’s login credentials. However, if you have to delve into your site’s file, the following will be essential:

  • You’ll need to find out your site’s current PHP version. With most modern WordPress hosts, this can be found within your account dashboard. However, you may need command line access to your site.
  • Administrator access to your server. If you’re the site owner, your credentials should be somewhere on your hosting account’s dashboard.
  • A Secure File Transfer Protocol (SFTP) client. SFTP is how you’ll access your site’s files, and a free tool such as Cyberduck or FileZilla is perfect. You may also need to sharpen your FTP skills.
  • A code editor, such as Atom. You may need to write a quick file and upload it to your WordPress server. Even your standard text editor will do in a pinch.

Once you have these to hand, you’re ready. However, you might not need them all. Our advice is to grab them if you get to step two below.

Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress: How to Fix the Error (In 3 Steps)

If you don’t fancy working under the hood of your WordPress installation, the error is often fixed before this stage. Here are the three steps you can take to solve the issue:

The hope is that the first step will resolve the error. As such, let’s look at this step first.

Step 1. Update Your WordPress Installation

First up is an easy solution that will take about two clicks. Head to the Dashboard > Updates screen within the WordPress back end, and see if there are any core updates to apply:

The WordPress Updates page.

If there are, click the button to install them. Once WordPress has finished, check for the error again. If there’s no error, mop your brow and pour yourself a well-earned drink.

To stop this appearing in the future, remember to apply WordPress updates on a frequent basis, and/or keep up to date with the PHP version on your server.

However, if you still see the error – or if WordPress is up to date – you’ll have work to do under the hood.

Step 2. Check the PHP Version of Your Server

From this point on, you’ll be working within WordPress’ core files. As such, make sure you carry out a clean backup first.

1. Create an info.php File and Log Into Your Server

When you’re ready, crack open your text editor, and enter the following:

<?php phpinfo(); ?>

Save this file as info.php. Next, log into your site using SFTP with the credentials from your account’s dashboard. You should see a list of your site’s files:

The Cyberduck FTP client, showing your WordPress files.

Note that if you run more than one site, there will be multiple folders here. There will be one site within the primary public_html or www folder. Your other sites will often be in a directory with the same name as the site in question.

2. Upload Your info.php File and Check Your Site

Next, upload the info.php file to your server. Often you can just drag and drop the file itself. Then, head to example.com/info.php (replacing the placeholder with your domain). Here, you’ll see a page full of diagnostics:

The PHP diagnostics page.

This contains details on your server’s PHP configuration. However, the part you need is the PHP Version entry in the Core section:

Checking the PHP version of your server.

If the number here begins with a 7, and a WordPress update hasn’t resolved the issue, our advice is to contact your host. There could be something going on that requires expert eyes.

Step 3. Configure (and Possibly Install) the MySQL Extension

If the other resolutions haven’t worked, this likely means you have an old version of PHP. However, you could also be missing the MySQL extension named in the error. Here’s how to resolve it.

1. Check Your info.php File

For this step, head back to your example.com/info.php file. Again, you’ll want to replace the placeholder domain with your own. This time, look for the mysqli or mysql section:

The mysqli section of your PHP diagnostics.

The MySQL extension is installed if you can see a number next to the Client API library version field. If not, you’ll need to contact your host. The solution is often to update your PHP version – this is something your host may need to do on this occasion.

2. Check That You’ve Configured the MySQL Extension Correctly

If your MySQL extension is present, the final step is to check its configuration. Often, your php.ini file will either be for the wrong Operating System (OS), or have the wrong file path.

The quickest way to reconfigure the file is to remove it from your server. Head back to your site’s info.php file, and check the path under the Loaded Configuration File field:

Finding the Loaded Configuration File.

Next, head to the location in your server – you’ll want to use SFTP again. From here, drag the file to your computer to back it up. Finally, delete the file from the server.

Finally, navigate to the front end of your site to check everything is working, then look at the back end for the error. If it’s gone, you can celebrate. If not, we suggest contacting your host, as they will need to diagnose the issue further.

Wrapping Up

Most WordPress errors have the same standard fixes. However, Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress is a tricky one because of the nature of the issue.

This post has looked at three steps to fix the error. Let’s recap:

  1. Update WordPress’ core files.
  2. Check the PHP version on your server.
  3. Make sure you’ve installed the MySQL extension and configured it.

Is this an error you’ve come across before? If so, was there a fix that we haven’t included here? Let us know in the comments section below!

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *