1. Web Design
  2. WordPress
  3. WordPress Hosting

WordPress Troubleshooting: PHP Installation Is Missing the MySQL Extension

Scroll to top
Read Time: 4 min

In this quick article, we’ll discuss how to troubleshoot the "missing the MySQL extension" error when you are installing WordPress.

If you’re installing WordPress or you’ve moved your website to a different server, you may encounter the following error:

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

This can be frustrating for you as a WordPress admin, if you don’t know the cause of this error. Today, we’ll go through the possible solutions that could fix this error.

Before we go ahead and discuss the possible solutions, let’s quickly fetch the code which displays this error.

if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' )
        // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.

        && ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' )
            || ! file_exists( ABSPATH . 'wp-content/db.php' ) )
    ) {
        require_once ABSPATH . WPINC . '/functions.php';
        $args = array(
            'exit' => false,
            'code' => 'mysql_not_found',
            __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ),
            __( 'Requirements Not Met' ),
        exit( 1 );

As you can see, WordPress is trying to load a couple of extensions that are related to MySQL. Specifically, it’s checking for the availability of the mysql, mysqli, and mysqlnd PHP extensions. If WordPress finds that none of these extensions are installed and configured with your PHP, it won’t be able to work with your MySQL database. And thus, it complains so that you can take the necessary actions to fix it.

In this post, we’ll discuss the possible solutions you could use to fix this issue.

Verify the MySQL Extension Installation

The root cause of this error is the unavailability of the PHP extensions that are required for database operations. So the first thing is to check if one of the MySQL extensions is installed and enabled on your server. There are a couple of ways you could do it.

First, create an info.php file with the following contents.


Upload this file to the document root of your WordPress website. Next, open the https://your-wordpress-website/info.php URL in your browser, and it should display the PHP configuration information, as shown in the following screenshot.


Now, try to find the mysql or mysqli extension section. If one of these is installed and configured in your PHP installation, you should be able to find it, as shown in the following screenshot.

Mysqli SectionMysqli SectionMysqli Section

If you don’t find it, it means that it’s not installed on your server. In this case, you just need to install the mysql or mysqli extension, and you’re good to go.

If you want to install it yourself, take a look at my article explaining how to install specific PHP extensions on your server. You’ll need to have root access to your server shell in order to be able to install it yourself. If you don’t have access or you don’t want to mess with the server admin, you could ask your hosting provider, and they should be able to do it for you pretty quickly.

In most cases, this is the root cause of this error. After installing the necessary extension, your WordPress site should start working.

On the other hand, if you find that the necessary extensions are installed and configured properly, and still you’re getting this error, you could go through the next section to see if that works for you.

Verify the WordPress Version

It could be that you’re running an old WordPress version, but that PHP and related extensions are upgraded to the latest version on your server. For example, if you have moved your site to a new hosting provider, this could cause a version incompatibility between your WordPress and PHP versions.

If you find that you’re running an old WordPress version, I would recommend that you upgrade your site to the latest version. When you upgrade your WordPress, it replaces old files with new ones, and that may fix this error. You can learn how to upgrade your WordPress version in this article.

Of course, even if you don't have any errors, it’s recommended to upgrade your WordPress periodically to the latest stable version. This will help protect you against any security vulnerabilities that may exist in the older WordPress version.


Today, we discussed a couple of possible solutions to the "missing the MySQL extension" error in WordPress. Let me know in the comments below if you have any other questions! And check out some of our other posts for more WordPress tips and tricks.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Web Design tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.