WordPress is regarded as a highly reliable and powerful software, but it’s not without it’s occasional glitch. There are a handful of common issues users may face and error messages they may encounter, and the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error is one of those messages.
This message can be really frustrating and concerning, but fortunately, there are some easy steps you can take to better understand the cause of this problem and find a solution.
In this KB article, we will discuss what this error means, some of the reasons it happens, and how you can fix it.
What Does “Your PHP Installation Appears to be Missing the MySQL Extension Which Is Required by WordPress” Mean?
There are a handful of reasons you might see this message on your WordPress site.
One reason is that the PHP installation on the server doesn’t have the required MySQL extension to connect WordPress to your MySQL database. It’s really important to know that support for this extension was deprecated in versions of PHP 7.0 and beyond.
This means if you are seeing this message, your WordPress’ site core code isn’t compatible with the version of PHP you’re using. This can also indicate:
- MySQL isn’t installed or enabled.
- The PHP extension is not properly configured.
- Your WordPress files are outdated.
This issue is very common on server environments that don’t have MySQL installed by default, but at ChemiCloud, this is installed on our servers for you, so you won’t have to worry about that being the cause of the problem.
How to Fix “Your PHP Installation Appears to be Missing the MySQL Extension Which Is Required by WordPress” Error
Update Your WordPress Installation
The easiest way to fix this error and the first thing you should try is to update your WordPress installation to the most recent version. To do this, just log in to your /wp-admin and click Updates from the left:
On the Update page, look for an update to your WordPress installation:
Once you’ve updated, visit your site again and see if your issue is resolved.
If not, proceed to step 2.
Make Sure the MySQL Extension Is Installed
If updating your WordPress installation didn’t help, or you didn’t have an update to do, the next prudent step would be to check if the MySQL extension is installed and enabled.
Some operating systems don’t include the MySQL extension by default. If you’re using a custom operating system configuration, you may need to install it yourself.
You can check if the MySQL extension is installed by creating a php.info in your public_html folder.
Step 1: Open your cPanel and in the Files section, click File Manager:
Step 2: When the file manager is open, double click the globe icon next to the public_html folder to open the folder.
Step 3: When the public_html folder is open, click the + File icon in the top left of the file manager.
A modal will appear where you can give the file a name. Enter info.php and click Create a new file.
Step 4: After the file is created, single-click the file in the directory listing, then click Edit at the top:
The modal window will appear where you will be given the option to check the UTF encoding.
95% of users can proceed and click Edit.
A new window will open with a text editor:
Copy and paste the text below into the editor, then click Save Changes in the top right:
<?php // Show all information, defaults to INFO_ALL phpinfo(); // Show just the module information. // phpinfo(8) yields identical results. phpinfo(INFO_MODULES);
Your screen should look similar to the one below:
Now, open a new tab in your browser and visit https://yourdomain.tld/info.php. You’ll see a page with the details of your PHP installation:
Look for the mysql or mysqli section. If the extension is installed, it will display the version next to Client API:
If it’s blank, the extension is not installed. The steps to install it varies depending on your web host and their servers/infrastructure. For detailed guidance, you can refer to the PHP documentation and installation guides.
If your host uses cPanel, you can enable the MySQL extension by clicking on Select PHP Version under Software:
After choosing the most recent PHP version, tick the boxes for “mysqli” and/or “mysqlnd”. Save your changes, then refresh your site to see if the error is resolved.
If not, proceed to step 3.
Verify the PHP Extension Is Properly Configured
If Step 2 didn’t help, it’s highly probable/likely that your PHP extension directory is not configured properly, if at all. Go back to the php.info page you created and look for “Loaded Configuration File”.
This is where you will find the value to the path which will look very similar to the image below:
Make a note of the path value.
Next, locate the extension_dir parameter:
The entry should match up with the Loaded Configuration File path. In the above example, you’ll notice that it displays the correct extension directory path for the PHP version installed on our server.
However, if yours is pointing to the incorrect location, you’ll need to edit your php.ini file to replace it with the correct one.
And that’s it!
These steps will help you get your WordPress site fixed, however, if you have reviewed these steps and are still unable to fix the problem, definitely open a ticket from your Lab to contact our Support Team 24×7!
If you enjoyed this tutorial, then you’ll love our support! All ChemiCloud’s hosting plans include 24/7 support from our amazing support team. Check out our WordPress hosting plans and have your website migrated today!