How to fix Wordpress PHP error missing MySQL extension

Posted on Dec 21, 2022


When running a WordPress site, you might see an error message that says:

Your PHP installation appears to be missing the MySQL extension 
which is required by Wordpress

This error message appears because your PHP server doesn’t have the MySQL extension, which is used by PHP to connect to MySQL database.

Since WordPress uses MySQL for storing data, the MySQL extension must be enabled in your PHP server configuration.

To fix this error, you will need to install and enable the PHP MySQL extension. Here are the steps you can follow:

Check if the PHP MySQL extension is installed: The first step is to check if the PHP MySQL extension is already installed on your server. To do this, you can create a PHP script with the following code:

<?php
phpinfo();
?>

Save the script as “phpinfo.php” and upload it to your server using FTP. Make sure you are uploading the file at the root directory of your website.

Next, access the script from your browser as "http://yourdomain.com/phpinfo.php".

You will see a page with information about your PHP installation, including the installed extensions.

You need to look for the mysql or mysqli extension on this page as shown below:

If it is not listed, then the extension is not installed on your server.

At this point, you are recommended to contact your hosting provider and ask them to install and enable MySQL extension for you.

If you want to try to install it yourself, see if your hosting uses cPanel as the hosting control panel.

If you use cPanel, then look for the Select PHP Version menu as follows:

Next, click on the Extensions tab and you will see the list of all PHP extensions available on your server.

Find and check the pdo_mysql and mysqli extensions on this tab as shown below:

Once you enabled the extensions, the error message should disappear from your WordPress site.

If you can’t find the extension, then you need to contact your hosting support team.

And now you’ve learned how to fix “Your PHP installation appears to be missing the MySQL extension which is required by Wordpress” error. Very nice!

Level up your programming skills

I'm sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.