WordPress is one of the most versatile and robust content management systems (CMSs) out there. Still, you may occasionally run into some issues when using it. One of those is an error informing you that “your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
The good news is that this is a relatively straightforward problem with a handful of quick and easy solutions. Once you understand what the error means and the common causes of it, you’ll be better prepared to resolve it and prevent it from happening again.
Below, we’ll explain what the WordPress MySQL extension error is and some of its common causes. Then, we’ll walk you through how to fix the problem as well as how to prevent it from happening again.
What is the WordPress MySQL extension error?
Before we get into resolving this error message, it’s important to understand what it means. So let’s go over some basics.
First of all, Hypertext Preprocessor (PHP) is a server-side scripting language designed for web development. It’s also the most popular scripting language today, as well as the primary language of WordPress.
MySQL is a database management system used by WordPress to store your site’s information. This is where you can find all of your database tables and files.
When you’re working on your website, you may come across the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error message. If you’ve never encountered this issue, you may be confused as to what it means, let alone how to fix it.
This error message will usually show up when you try to install or update WordPress. Although an error message like this can be frustrating and stressful, there’s no need to panic.
What causes the MySQL extension error on WordPress?
There are a handful of reasons you might be dealing with this problem. Typically, it means that something is wrong with your site’s code. As the error message indicates, some element is preventing WordPress from properly connecting to the MySQL database.
One of the most common causes of the error is that your server does not have the MySQL extension installed or enabled. Usually, this can be attributed to one of two things:
First, you may be using an incompatible version of PHP. MySQL 5.0 requires PHP 5.2 or higher. WordPress recommends using the latest stable version of PHP, which is currently PHP 7.4.
If you’re using a particularly outdated version of WordPress with a modern version of PHP, this error can also happen. PHP 7.0 deprecated the MySQL extension and WordPress now uses the newer PDO_MySQL or MySQLi extensions.
The other possibility is that your PHP is misconfigured, meaning it’s not properly set up to work with your WordPress site. In addition to being outdated or incompatible, it could be due to incorrect server settings.
How to fix the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error
Now that you understand more about what the message means and what may be causing it, let’s take a look at how to resolve it.
1. Update WordPress
As we mentioned, using an older version of WordPress, like 3.9 or lower, might cause this error message. Therefore, one of the first steps you should take to resolve it is to make sure that you’re using the most updated version of WordPress Core.
This is likely the source of the problem if you’re using the latest version of PHP (which we’ll cover in the next section). To determine whether there’s an update available, you can navigate to your admin area and go to Dashboard → Updates.
Note that if you’re using a WordPress.com site, you can find updates under My Home → Updates, instead. Any available updates will be shown on this screen.
It will also inform you of what version of WordPress you’re currently using. If you see a notification saying “An updated version of WordPress is available,” you can select the Update to version [X] button.
On this page, you can also view any plugin and theme updates that are available. As with WordPress Core, plugins can present compatibility issues with PHP that may result in the MySQL extension error.
So, we also recommend updating any plugins that have newer versions available. If there are multiple, you can simply select all, then click on Update Plugins.
2. Check your PHP version
Once you’re sure that your WordPress core is up to date, the next step is to check which version of PHP your server is using. There are a couple of ways to go about this.
The easiest option is to navigate to Tools → Site Health from your WordPress dashboard.
Next, you can select the Info tab, then scroll down and expand the Server panel. Under this section, you can locate the PHP version you’re currently running.
If you’re not able to access your WordPress admin, you can check your PHP version by connecting to your server via a File Transfer Protocol (FTP) client like FileZilla. Alternatively, if your web host uses cPanel, you can use the File Manager tool.
Either in your FTP client or your File Manager, create a new file in the root directory of your site (/public_html) and name it phpinfo.php. Next, open the file and copy and paste the following code snippet:
<?php phpinfo(); ?>
Save the file when you’re done. Then, in a new browser tab, visit “yoursite.com/phpinfo.php”. Be sure to replace “yoursite.com” with your domain name.
Now you should see a page that displays your server’s PHP configuration information.
The PHP version your server is running should be listed at the top of the screen. If it begins with 7 or 8, an outdated version of PHP probably isn’t the reason you’re seeing the error message.
If you’re using PHP 5.X, you should consider updating your PHP version.
3. Ensure the MySQL extension is installed
If your WordPress version is up to date, it’s important to also check whether the MySQL extension is installed and enabled. It’s possible that the Operating System (OS) you’re using didn’t include the extension by default, which means you’ll have to install it yourself.
To determine whether it’s installed, revisit the phpinfo.php file that you created in the last step. Then, navigate to the mysqli or mysql section. If the MySQL extension is installed, it will indicate the version of it next to the Client API field.
But, if this field is blank or not visible at all, it means that the MySQL extension is not installed. The process for installation will depend on your host. You can refer to the PHP installation guide for details.
If your provider uses cPanel, you can enable the extension by navigating to Software from your cPanel dashboard, then choosing Select PHP Version.
Here, select the most recent version of PHP, then click on the boxes for mysqli and mysqlnd. Save your changes, then revisit your site to see if you’re still seeing the error message.
Alternatively, if you’re unsure about installing the MySQL extension on your own, you may want to reach out to your web host. You can always request that they complete this process for you.
4. Verify that the PHP extension is properly configured
Once you know that your WordPress version is up to date and the MySQL extension is installed, you can safely confirm that something else is causing the problem. Another reason you might be seeing the error message is that the extension is not configured correctly.
There are a few issues that can lead to misconfiguration, including incorrect file paths or using a php.ini file intended for a different type of server. For instance, you may be using one meant for Windows servers on a Linux server.
To verify that your PHP extension is configured properly, navigate back to your phpinfo.php file. Then, locate the Loaded Configuration File item.
This is where you can find the file path value. Note the file path listed here, then look for the extension_dir row.
The file path listed here should match what is listed for the Loaded Configuration File. If not, the next step is to edit your php.ini file to correct it. When you’re done, revisit your site to make sure the error is resolved.
Tips for preventing the MySQL extension error in WordPress from happening again
At this point, you’ve learned how to fix the MySQL extension error in WordPress. But there are also steps that you can take to prevent it from happening in the future.
The first is to back up your WordPress site in real time. Keeping updated copies of your site files can make it easier to identify the source of issues as they occur. When you use a solution like Jetpack, you can also ensure that you always have an updated version of your site to restore in the event that something goes wrong.
It’s also crucial to make sure you’re keeping your WordPress software up to date. Not only can this help prevent errors like the MySQL extension issue, but it can provide security and performance enhancements for your site as well.
Finally, be sure to choose a WordPress web host that uses updated versions of PHP. When providers automatically handle these updates for you, this eliminates the need to manually manage it yourself. They can also help streamline server configuration to ensure that you’re adhering to best practices.
In turn, this can reduce the likelihood of running into PHP-related errors. There are a wide variety of high-quality and reliable WordPress hosts to choose from. Some of the top WordPress hosts include Bluehost, DreamHost, and Pressable.
Streamline WordPress website maintenance
WordPress is a powerful and dependable CMS, but you can still run into issues from time to time when using it. You might encounter an error message informing you that “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” Fortunately, there are a handful of solutions you can use to resolve this problem.
As we discussed, there are four measures you can take to fix this error in WordPress:
- Update your WordPress software and plugins.
- Check your PHP version and update it, if necessary.
- Ensure that the MySQL extension is installed.
- Verify that the PHP extension is properly configured.
To help prevent WordPress errors from happening in the future and to make troubleshooting and resolving any issues easier, it’s important to back up your site in real time. Learn how Jetpack Backup can make this a breeze!