3 Ways to Fix ‘Missing MySQL Extension’ in PHP Installation Required by WordPress’

Errors in WordPress

Started out in 2003, WordPress has come a long way to become the most successful CMS (Content Management System) powering more than 30% of the websites on the Internet. This means it is dominating the CMS market with 60% market share. Even with such popularity, WordPress users face a lot of difficulties in day to day operations because of constant errors.

In many of our blogs, we have discussed such errors and educating you in how you resolve them. In this blog, we will be discussing yet another error that occurs quite frequently. This error appears as ‘ PHP Installation Appears to be Missing MySQL Extension Required by WordPress.’

Before we get into the cures or fixes of this error, it is important to understand this error and why it occurs. We believe that if you know the basics, half the job is done then.

So, let’s learn the basics.

What is this error?

What does it mean by ‘Your PHP Installation Appears to be Missing MySQL Extension Required by WordPress’? There is no single reason why you’re getting this error message on your WordPress site.

One scenario can be that your PHP installation on the server lacks the required MySQL extension which is indispensable to connect your WordPress site to MySQL database.

WordPress code incompatibility with the current PHP version could be another reason why you’re seeing this error message.

  1. Perhaps, you might encounter this mind-numbing error message at the time of WordPress website migration or changing server configuration.

More specifically, it can happen as a result of the following:

  1. Outdated WordPress files
  2. Uninstalled or disabled MySQL extension
  3. Improperly configured PHP extension

So, for whatever the reason that you are seeing this error, it needs to be fixed. Since there are so many reasons that can cause this error, the methods to fix this are as many. But, in this article, we will discuss the 3 most commonly used methods that can fix this error for any reason it is occurring. 

Let’s discuss it in the next section.

What are the Three Methods to Fix ‘Your PHP Installation Appears to be Missing the MySQL Extension which is Required by WordPress’?

Now is the time to learn about the fixes for the error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”. Before we begin, there are certain factors which must be taken under-consideration to get rid of this error message proactively such as ‘type of hosting’ or ‘inability to to access site files through FTP’, etc.


The three fixes for “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error are:

  1. Update your WordPress Installation
  2. Check out that whether MySQL Extension is Properly Installed and Enabled
  3. Make Sure PHP Extension is Correctly Configured

We will discuss each of thiem in detail below starting with the first one.

1. Update your WordPress Installation

The first method to fix ‘Your PHP Installation Appears to be Missing the MySQL Extension which is Required by WordPress’ is to update your WordPress installation. Use the following process to get rid of the technical glitch
  • First, log into dashboard and clicks Updates:
  • Now, you’ll be taken to the next screen, where you will click on ‘Update Now’ – you can see this button under WordPress version update. Check the image below:
  • When you’re done, visit your website again to check whether this error has been resolved.

If this method does not fix the error, try the next one.

2. Check out whether MySQL Extension is Properly Installed and Enabled

The next method involves checking out whether MySQL extension is correctly installed. Actually, few operating systems such as Linux don’t add the MySQL extension by default. To fix this error, follow these steps:

  • Create an info.php file in the public_html(root directory) of your WordPress website through FTP. Make sure it contains the following:      
				
					<?php
phpinfo( );
?>
				
			
  • Now, save your file and visit your website in your browser (https://abcd.com/info.php). Here, you’ll see a page with all details of your PHP installation.
  • Once you have access to the page, look for the MySQL/MySQLi section. If the MySQL extension is correctly installed, you will see the version next to Client API (see image below):
  • If the version is blank, it means that the extension is not installed in the correct way.
  • Since the installation of MySQL extension depends on the host and your system, it will recommend you to go through PHP documentation and installation guides for further guidance.

Follow the next steps to enable MySQL extension through cPanel.

  • If you come to know that your host is using cPanel, enable the MySQL extension right away by clicking on Select PHP version under software:
  • Once you’ve chosen the current PHP version, tick the boxes for “mysqli’ or ‘mysqlnd’ (depending on the situation, you will have to click on both simultaneously).
  • Save your changes without wasting time and click ‘refresh’ to find out whether the error has been resolved.

The final fix is:

3. Make Sure PHP Extension is Correctly Configured

If this error seems unsolved after following the fixes mentioned above

  • Updating your WordPress Installation,
  • checking out whether MySQL is correctly installed)…….

……then there is a possibility that it could be due to an un-configured PHP extension directory. For this method to work, you will have to start from the first step of fix method # 2 mentioned above.

  • Go back to PHP info page in your browser and look for “Loaded Configuration File”
  • In that file, you’ll get file path value which look like this:
  • At this stage, you will locate extension_dir parameter:

Thing to Note: The entry should be matching the Loaded Configuration File path.

  • Take a look at the image above, it must be displaying the right extension directory path. If you see that it points to the incorrect location, edit your php.ini file to replace it with the correct file.

This should help fix the ‘Missing MySQL Extension in PHP Installation Required by WordPress’ error.

What Have We Learned!!

Although WordPress has become talk-of-the-town with top-notch functionalities and easy-of-use it’s not uncommon to see it faltering occasionally. Conversely, the majority of its problems are solvable with little technical knowledge and past experience. This is true for the error discussed today in this article, ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress.’

As you have gone through the article, you would have realized that fixing this error is not highly technical and is simple enough that anyone can do it. But even with this, errors such as these occur on a daily basis in WordPress. What needs to be done is to become proactive instead of reactive. How? By regularly doing maintenance work on the website in order to keep up with the updates.

But it is a tedious task. A word of advice – consult a WordPress maintenance company to take this tedious task off your hand. Whether the problem is non-technical or technical, experts can help you out instead of you worrying about the errors and fixes and focusing less on your business.