How to Fix “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” Error
If you encounter "Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress" error message when trying to install or access your WordPress site, it means that your PHP installation on the server does not have the right MySQL extension to connect your WordPress site to its MySQL database.
In other words, your WordPress version is not compatible with the PHP version you are using.
There are several possible causes and solutions for this issue. In this article, we will cover a series of solutions.
Note: before doing any changes I highly recommend to backup your website.
1. Update WordPress
If you are using an outdated version of WordPress with a modern version of PHP (7.0 or higher), you might encounter this error because PHP 7.0 deprecated the MySQL extension in favor of MySQLi. That means that PHP 7+ no longer includes the MySQL extension that WordPress is looking for.
Modern versions of WordPress (3.9 or higher) will use the newer PDO_MySQL or MySQLi extensions instead. However, older versions of WordPress might cause this problem.
To fix this, you need to update your WordPress core software to the latest version. You can do this in two ways:
Option 1: Update from your WordPress dashboard
If you can log in to your WordPress dashboard, you can update WordPress from there. Go to Dashboard > Updates and click on Update Now.
WordPress will automatically download and install the latest version.
Option 2: Update manually via FTP
If you cannot log in to your WordPress dashboard, you can update WordPress manually via FTP. You will need an FTP client like Filezilla and your FTP credentials from your web host.
- Download the latest version of WordPress from https://wordpress.org/download/
- Unzip the downloaded file on your computer.
- Log in to your server using your FTP client.
- Rename your existing wp-includes and wp-admin folders to something like wp-includes.old and wp-admin.old
- Upload the new wp-includes and wp-admin folders from the unzipped file to your server.
- Upload all the files from the unzipped file's root folder (except wp-config.php) to your server, overwriting the existing files.
- Visit
yourdomain.com/wp-admin/upgrade.php
in your browser. WordPress will run some database updates if needed.
2. Update .HTACCESS File
Go to your cPanel, open file manager and edit .htaccess file and check if you find something like this then remove and check if problem solved or not.
If you see something like marked in above image, then delete and save it. Now check if problem solved or not.
3. Check and Update PHP version
The first step is to find out which version of PHP your server is running. You can do this in two ways:
Option 1: Check php version from your WordPress dashboard
If you can log in to your WordPress dashboard, you can check the PHP version from there.
Go to Tools > Site Health and look for the PHP version under Site Health Status. WordPress will tell you if your PHP version is up to date or needs to be updated.
Option 2: Check php version from your FTP client
If you cannot log in to your WordPress dashboard, you can check the PHP version from your FTP client. You will need an FTP client like Filezilla and your FTP credentials from your web host.
- Log in to your server using your FTP client
- Open your public_html folder. This is the root directory of your WordPress site
- Create a blank file and name it phpinfo.php
- Edit this file and add the following code:
<?php
phpinfo();
?>
- Save and upload this file to your server
- Visit
yourdomain.com/phpinfo.php
in your browser. You should see a page with information about your PHP configuration, including the PHP version.
3.1) Update PHP Version
- Log in to your cPanel account
- Go to Software > PHP Selector or something like that.
- Select latest PHP version and Save
4. Install required MySQL extensions
If you are using PHP 5.6 or lower (before the MySQL extension was deprecated), but the extension is missing or improperly configured, you might encounter this error as well.
To fix this, you need to make sure that the MySQL extension is installed and enabled on your server. You can do this in two ways:
Option 1: Check from phpinfo.php
If you have created a phpinfo.php file in the previous step, you can use it to check if the MySQL extension is installed and enabled on your server.
- Visit
yourdomain.com/phpinfo.php
in your browser - Look for a section called mysql
- If you see it, it means that the MySQL extension is installed and enabled on your server
- If you don't see it, it means that the MySQL extension is missing or disabled on your server
Option 2: Check from cPanel
If you have access to cPanel, you can use it to check and install the MySQL extension on your server.
- Log in to your cPanel account
- Go to Software > Select PHP Version
- You should see a list of PHP extensions that you can enable or disable on your server
- Look for mysql or mysqli and make sure they are checked.
- If they are not checked, check them and click on Save
If they are not listed, contact your web host and ask them to install the MySQL extension on your server.
5. Make sure the PHP extension is configured properly.
If the MySQL extension is installed and enabled on your server, but you still see this error, it might be because the PHP extension is not configured properly.
To fix this, you need to make sure that the PHP extension is pointing to the correct path on your server. You can do this by editing your php.ini file.
Browse https://example.com/phpinfo.php file (that you created) to find out where it is. Look for a line that says Loaded Configuration File and note down the path.
Now 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.
6. Use managed WordPress hosting
To stay away from this kind of technical errors that hampered business operations and give extra hassles it is better to move a good managed WordPress hosting.
Managed WordPress hosting providers like Hostinger (Budget friendly) and CloudWays (Value for money) are my recommendation. I personally used them and using for years.
For Our Readers CloudWays Offer 20% Off for 2 Months. Use promo code "WpConsults2024" to grab it ASAP.
Managed WordPress hosting providers normally keeps functional and updated their server based on latest WordPress updates and requirements that eliminate a lot of unnecessary hassles.
I hope this article helped you fix the error "Your PHP installation appears to be missing the MySQL extension which is required by WordPress". If you have any questions, ask me in comments.
Read More