A message stating that "Your PHP installation appears to be missing the MySQL extension which is required by WordPress" appears when you try to install WordPress or access your WordPress site.
It can be annoying to experience a problem that prevents you from using or accessing your WordPress site, just like with any WordPress error message.
However, don't give up hope!
This error typically indicates that something is wrong with the website's code and that WordPress is unable to connect to its MySQL database.
We'll discuss what that "something" might be in this article, along with some advice on how to analyze and resolve this error message.
What Leads to the Missing MySQL Extension Error in WordPress?
The error message "Your PHP installation appears to be missing the MySQL extension which is required by WordPress" results, as we mentioned in the introduction, from a problem with the code or scripts on your server.
This error specifically indicates that your server's PHP does not have the necessary extension to link your WordPress website to its MySQL database.
This could be the case for two main reasons:
1. You're Using an Older WordPress Version with PHP 7+
Because PHP 7.0 deprecated the MySQL extension in favor of MySQLi, you might run into this error if you're using an extremely old version of WordPress with a modern version of PHP.
In other words, PHP 7+ no longer has the MySQL extension that WordPress requires.
Instead, more recent PDO MySQL or MySQLi extensions are used by WordPress in modern versions. However, WordPress versions prior to version 3.9 may be the cause of this issue.
You might also want to learn how to upgrade your PHP version in WordPress.
The Extension Is Missing or Not Setup Correctly When Using PHP 5.6 or Lower
The other likely reason is that PHP 5.6, which was released before the MySQL extension was deprecated, is being used, but that the extension is either missing or not configured correctly.
Ways to Fix WordPress appears to require the MySQL extension, which your PHP installation appears to be missing
Now that you are aware of what is happening, let's discuss some advice for resolving the problem.
Check What Version of PHP You’re Using
Finding out which PHP version is installed on the server hosting your WordPress site is the first step in diagnosing this problem. The answer to this query will determine what actions you should take next.
Use FTP to connect to the server hosting your WordPress website to verify this. Your web host can provide you with your FTP credentials, but you'll also need an FTP client to connect.
You can use the cPanel File Manager tool if your host is running cPanel.
Once you've established a connection to your server, create a new file called phpinfo.php in the root directory of your WordPress website. This should be the same folder that contains your wp-config.php file.
Then, edit the file and add the following code snippet:
Visit yoursite.com/phpinfo.php after saving the file (and re-uploading the saved version if necessary). Be sure to replace yoursite.com with your actual domain name.
A screen with numerous different details about the PHP configuration on your server ought to appear. Look for the PHP Version item in the Core section as you scroll down.
Keep an eye on the numbers; you should see something along the lines of x.x.x, such as 7.2.25 or 5.6.8:
The WordPress software typically needs to be updated if your PHP version begins with a "7." On the other hand, you might not have the MySQL extension if you're still using PHP 5.X.
Note: At Kinsta, they strongly advise using the most recent PHP release. Actually, they don't support PHP versions earlier than 7.4.
Due to their slower performance and lack of security updates, these outdated versions could be a security risk for your website.
Learn more about the advantages of using current, supported PHP versions.
2. Update the Core WordPress Software
The most likely reason for this error, if your server supports PHP 7+, is that you're using an outdated version of WordPress. This error can occur if you're using WordPress version 3.9 or earlier.
The solution is to update your WordPress software, which will also add a ton of new features and enhance security and performance.
Make sure you have a backup of your website before manually updating your WordPress version. You can get the most recent version of the WordPress software by visiting WordPress.org.
Extract the zip file to your computer after downloading it. Then, delete the following items from the folder that contains all of the WordPress files:
- the file wp-config-sample.php
- The wp-config.php file (you might not see this file – just make sure to delete it if it’s there).
- the folder wp-content.
After removing those items, use FTP to upload the remaining files and folders to your server. Your FTP client should be instructed to overwrite all files when asked about duplicate files.
Your WordPress site should be using the most recent version and your problem should be resolved once the file uploads are complete.
3. Check to See If the MySQL Extension Is Installed
Your server may not have the MySQL extension that WordPress needs if it is still running PHP 5.6 or an earlier version.
Return to the phpinfo.php file that you first uploaded to your server in Step 1 to see if this is the case.
Search for a section with the name mysql or mysqli.
If the MySQL extension is installed, the Client API library version item ought to have a version number next to it; if you are unable to locate this data, the MySQL extension is not present.
The best course of action is typically to contact the support team of your host and request that they install it for you.
Note that PHP versions below 7.4 no longer receive security updates and perform worse than more recent versions, so we strongly advise against using them.
Upgrade your server to PHP 7.4+ instead of spending time correctly configuring an older version of PHP, unless you absolutely must continue using PHP 5.6 or lower.
You can follow our instructions to install PHP on any server and to update the PHP version of your WordPress website.
4. Make Sure PHP Extension Is Configured Properly
If the extension is installed and you're running PHP 5.6 or lower, the problem might be that it's not configured correctly. Two typical problems are:
- using a Linux server while uploading a php.ini file designed for Windows servers
- wrong file paths
The phpinfo.php file you previously created contains the location of your php.ini file:
First, we advise downloading the existing file to your local computer as a backup. Try deleting the php.ini file next to see if that resolves the issue.
IMH
Do you want a fast website?
Who am I kidding? Don't we all?
So why do so many of us struggle?
The biggest challenge is usually finding a fast, reliable hosting company.
We've all been through the nightmares - support take takes forever or doesn't resolve our problem always blaming something on your side...
But the biggest bummer is that the website always feels slow.
At CollectiveRay we host with InMotion hosting and our website is stupid fast. We run on a custom stack of LightSpeed server setup on MariaDB with a PHP7.4 engine and fronted through Cloudflare.
Combined with our front-end optimizations we reliably server 6000 users every single day, with peaks of 50+ simultaneous users.
Want to get a fast setup like ours? Transfer your site for free to InMotion hosting and get our 50% OFF on current pricing.
Try InMotion Hosting with 50% OFF for CollectiveRay visitors in November 2024 ONLY!
Summary
It is frustrating error to run into the "Your PHP installation appears to be missing the MySQL extension which is required by WordPress" message.
However, by following the instructions in this article, you should be able to locate and fix the issue.
Make sure you're running the most recent versions of PHP and WordPress as per our suggested fix.
You should be able to automatically fix this error if you are using PHP 7.4+ and WordPress 5.0+, as well as gain access to all of the other performance, security, and feature improvements that come with updating.
Your PHP Installation Appears to Be Missing FAQs
The MySQL extension appears to be missing from your PHP installation. How can this be fixed?
The message "Your PHP installation appears to be missing the MySQL extension which is required by WordPress" can be fixed in three different ways, which we covered in this post. 1 Upgrade to the newest version of your WordPress installation. 2 Verify that the MySQL extension is set up and functional. 3 Confirm that the PHP extension is set up correctly.
How do I resolve the WordPress missing MySQL extension issue?
The missing MySQL extension error occurs when one of PHP or WordPress is updated but not the other. The simplest solution is to check your PHP's version number to see if it is 7 or higher. And then, make sure WordPress is running the latest version too, and upgrade whichever isn’t up to date.
Please leave a useful comment with your thoughts, then share this on your Facebook group(s) who would find this useful and let's reap the benefits together. Thank you for sharing and being nice!
Disclosure: This page may contain links to external sites for products which we love and wholeheartedly recommend. If you buy products we suggest, we may earn a referral fee. Such fees do not influence our recommendations and we do not accept payments for positive reviews.