How to fix: Your PHP Installation Appears To Be Missing MySQL Extension Which Is Required By WordPress

So, you have come across the obvious “Your PHP installation appears to be missing MySQL extension which is required by WordPress” error message.

There is no reason to worry. It has happened with many others.

We have received messages from our readers. That’s why we compiled this informational piece to assist all in troubleshooting and fixing the issue rapidly.

This issue is not new, and it appears every time when there is a change in the server configuration.

Let’s start the troubleshooting.

Fixing: Your PHP installation appears to be missing MySQL extension which is required by WordPress

There are two ways to troubleshoot. We will describe the detail with code explanation.

  1. Inspect if PHP’s MySQL extension is already in installation. If it is not installed, then install it.

When PHP needs to communicate SQL commands and retrieve responses from MySQL, then MySQL extension must be present.

It is an additional requirement of the PHP module, which is not installed by OS by default.

While troubleshooting, the easiest way to check whether MySQL extension is installed or not is by creating an info.php file. It is the best response when you see “Your PHP installation appears to be missing MySQL extension which is required by WordPress” error message.

Now, you must simply open a text editor and write the following code.

1|<?

2|phpinfo();

3|?>

Now, you must save the file as info.php and upload it to your web hosting server in the root directory.

Now, you need to open the page on your web browser such as www.yourdomain.com/info.php

It will show you the PHP installation.

In the Client API version, if there is nothing visible, then you do not have PHP’s MySQL extension installed.

PHP MySQL installation on Red Hat Compatible severs

You need to run the following commands for installation.

PHP 5:

# yum update

# yum install php-mysql

PHP 7:

# yum update

# yum install php70w-mysql

After entering the code, you need to restart the server. It is necessary for changes to take place.

  1. Inspect is there is a misconfiguration of PHP’s MySQL extension directory. If it is, then fix it.

After the installation of MySQL extension, if the error persists, then your PHP’s MySQL extension directory is misconfigured. You need to fix it.

For fixing, you need to locate PHP.ini file and make sure it’s “extension_dir” value is used.

Now, you must open info.php file that is created in the first step in your web browser.

You need to locate the parameter known as “Loaded Configuration File.”

Note the path value of the parameter of “Loaded Configuration File.”

Now, you must locate the entry for the “extension_dir.” It has to be of some value. If it is blank, then it does not have a correct path to PHP extensions.

If there is an incorrect location in “extension_dir,” then you must put the correct value by opening PHP.ini file.

Your error will not appear again.

Have a good day, and work towards your success.