How to fix “missing the MYSQL Extention which is required by WordPress” error

If you run into the following error within your WordPress installation:

“Your php installation appears to be missing the mysql extension which is required by wordpress.”

Then you are experiencing a fairly common WordPress error caused by incorrect PHP configurations.

Similar to your Chrome browser, PHP also works with extensions. For PHP to interact with a MYSQL database it requires the PHP MYSQL extension installed.

Newer PHP versions use a slightly different extension called MYSQLI or PDO_MYSQL. Whereas older PHP versions use an older PHP extension to connect to MySQL.

How do I fix the error?

Step 1: Changing PHP version

The first step you should take is to upgrade your PHP version. PHP version 7.3, 7.2, 7.1, 7.0 & 5.6 is at the end of life and deprecated. You should avoid using these PHP versions due to security vulnerabilities and performance issues, Instead upgrade to PHP 7.4 or to the latest PHP 8.0 which also provides additional performance benefits.

If you are using PHP 7.4+ and still seeing the error “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” then move on to the next step.

Step 2: Installing missing PHP MySQL extension

If you are still seeing the error after upgrading PHP, chances are you are not hosted with Koerge or any reputable web hosting provider. Instead, you are likely setting up your own VPS/Cloud server.

First thing to do is create an info.php file with the following code:

<?php
phpinfo();
?>

Once this is done, save and open the file from your browser. This will give you a full breakdown of your current PHP settings, here you will confirm what PHP is currently being used as well as see all active PHP extensions. You can use Control + F to search for MySQL and attempt to identify if the extension is active.

Unfortunately with so many different ways of setting up your own VPS/Cloud server it is almost impossible to cover all scenarios under a single article. However if you cannot find any of the two MYSQL extensions:

  • MYSQLi
  • PDO_MYSQL

Chances are you will need to install one in order for the error “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” to be fixed.

Join the thousands of websites that trust Koerge.

Subscribe

Receive WordPress tips, tricks and news straight to your inbox every week.