How to Fix "Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress" Error

  • 3,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 3
  • Tình trạng: Còn hàng

Trying vĩ đại install WordPress or visit your WordPress site only vĩ đại encounter an error that says “Your PHP installation appears vĩ đại be missing the MySQL extension which is required by WordPress.”?

As with any WordPress error message, it can be frustrating vĩ đại encounter a problem that prevents you from using/accessing your WordPress site.

However, don’t despair!

Generally, this error means that something is going wrong with the code on your site and something is preventing WordPress from being able vĩ đại connect vĩ đại its MySQL database.

In this article, we’ll go over what that “something” might be and share some tips on how vĩ đại troubleshoot and fix this error message.

What Causes the WordPress Missing MySQL Extension Error?

As we mentioned in the introduction, the error message “Your PHP installation appears vĩ đại be missing the MySQL extension which is required by WordPress” steps from some issue with the code/scripts on your server.

Specifically, this error means that the PHP on your server doesn’t have the necessary extension vĩ đại connect your WordPress site vĩ đại its MySQL database.

There are two main reasons why this might be the case:

1. You’re Using an Outdated Version of WordPress with PHP 7+

If you’re using a very old version of WordPress with a modern version of PHP, you might encounter this error because PHP 7.0 deprecated the MySQL extension in favor of MySQLi. That is, PHP 7+ no longer includes the MySQL extension that WordPress is looking for.

Modern versions of WordPress will instead use the newer PDO_MySQL or MySQLi extensions. However, older versions of WordPress (below version 3.9) might cause this problem.

2. You’re Using PHP 5.6 or Lower but the Extension Is Missing or Improperly Configured

The other likely cause is that you are using PHP 5.6 (before the MySQL extension was deprecated), but the extension is either missing or improperly configured.

How vĩ đại Fix “Your PHP installation appears vĩ đại be missing the MySQL extension which is required by WordPress”

Now that you know what’s going on, let’s go over some tips for how vĩ đại troubleshoot and fix the issue.

1. Check What Version of PHP You’re Using

The first step vĩ đại diagnose this issue is vĩ đại figure out which version of PHP your WordPress site’s server is running. The answer vĩ đại this question will dictate the next steps that you take.

To kiểm tra this, connect vĩ đại your WordPress site’s server using FTP. You can get your FTP credentials from your trang web host and you’ll also need an FTP client vĩ đại connect.

If your host is using cPanel, you can use the cPanel File Manager tool.

Once you’ve connected vĩ đại your server, create a new tệp tin called phpinfo.php in the root directory of your WordPress site. This should be the same thư mục that contains your wp-config.php file.

Then, edit the tệp tin and add the following code snippet:

phpinfo();
?>

Once you save the tệp tin (and re-upload the saved version if needed), navigate vĩ đại yoursite.com/phpinfo.php, making sure vĩ đại replace yoursite.com with your actual domain name name.

You should see a screen that displays a lot of different information about the PHP configuration on your server. Scroll down vĩ đại the Core section and look for the PHP Version item. Pay attention vĩ đại the numbers – you should see something lượt thích x.x.x. E.g. 7.2.25 or 5.6.8:

How vĩ đại kiểm tra WordPress PHP version
How vĩ đại kiểm tra your WordPress site’s PHP version

If your PHP version starts with a “7”, that usually means that you need vĩ đại update the WordPress software. On the other hand, if you’re still using PHP 5.X, you might be missing the MySQL extension.

Note – at Kinsta, we strongly recommend using the latest version of PHP. In fact, we don’t tư vấn versions below PHP 8.0. These older versions have slower performance and, because they no longer receive security updates, could pose a security risk vĩ đại your site.

Learn more about why it’s important vĩ đại use modern, supported PHP versions.

2. Update the Chip Core WordPress Software

If your server is using PHP 7+, the most likely cause of this error is that you’re running an old version of WordPress. If you’re using WordPress version 3.9 or lower, that can trigger this error.

Therefore, the fix is vĩ đại update your WordPress software, which will also come with lots of other features, security, and performance improvements.

To manually upgrade your WordPress version, first, make sure you have a backed up version of your site. Then, go vĩ đại WordPress.org and tải về the most recent copy of the WordPress software.

Once you’ve downloaded it, extract the zip tệp tin vĩ đại your computer. Then, open the thư mục that contains all of the WordPress files and delete the following items:

  • The wp-config-sample.php file.
  • The wp-config.php file (you might not see this tệp tin – just make sure vĩ đại delete it if it’s there).
  • The wp-content folder.

Once you’ve deleted those items, upload the remaining files/folders vĩ đại your server via FTP. When prompted about duplicate files by your FTP client, tell it vĩ đại overwrite all files:

How vĩ đại reinstall WordPress software
Reinstall WordPress by overwriting the existing files

Once the tệp tin uploads finish, your WordPress site should be running the most recent version and your issue should be fixed.

As a follow-up step, you should also make sure vĩ đại update all of your plugins and themes vĩ đại the latest versions as well. You can follow these guides:

  • How vĩ đại update WordPress plugins
  • How vĩ đại update WordPress themes

3. Check vĩ đại See If the MySQL Extension Is Installed

If your server is still using PHP 5.6 or lower, your server might be missing the MySQL extension that WordPress requires.

To kiểm tra if this is the case, go back vĩ đại the phpinfo.php tệp tin that you uploaded vĩ đại your server in Step #1.

Look for a section named either mysql or mysqli.

If the MySQL extension is installed, you should see a version number next vĩ đại the Client API library version item:

How vĩ đại see if WordPress MySQL extension is installed
How vĩ đại see if WordPress MySQL extension is installed

If you can’t find this information, that means the MySQL extension is not installed. The best solution is usually vĩ đại reach out vĩ đại your host’s tư vấn staff and ask them vĩ đại install it for you.

Note – again, we highly recommend not to use PHP versions below 8.0 because they no longer receive security updates and don’t perform as well as newer versions.

Unless you absolutely must continue using PHP 7.4 or lower, a much better solution is vĩ đại upgrade your server vĩ đại PHP 8+ instead of putting time into properly configuring an older version of PHP. You can follow our guide on how vĩ đại update the PHP version of your WordPress site and how vĩ đại install PHP on any server.

4. Make Sure PHP Extension Is Configured Properly

If you’re using PHP 5.6 or lower and the extension is installed, the issue might be that it’s not configured properly. Two common issues are:

  • Uploading a php.ini tệp tin that’s intended for Windows servers when you’re using a Linux server
  • Incorrect tệp tin paths.

You can find the location of your php.ini tệp tin in the phpinfo.php tệp tin that you created before:

How vĩ đại find WordPress php.ini tệp tin path
How vĩ đại find WordPress php.ini tệp tin path

First, we recommend backing up the existing tệp tin by downloading it vĩ đại your local computer. Then, try deleting the php.ini tệp tin and see if that fixes the problem.

Summary

The “Your PHP installation appears vĩ đại be missing the MySQL extension which is required by WordPress” message is a frustrating error vĩ đại encounter because it seems sánh technical.

However, with the steps in this article, you should be able vĩ đại diagnose and fix the issue.

Our recommended solution is vĩ đại make sure you’re using the most recent versions of both PHP and WordPress.

If you use PHP 8+ and WordPress 5.0+, you should be able vĩ đại automatically fix this error and get your site working again, while also benefiting from all of the other performance, security, and feature enhancements that come from updating.