5 reasons for error “Your PHP installation appears to be missing the MySQL extension” and how to fix it
Dedicated Support Engineers at Bobcares manage thousands of WordPress sites of web designers, digital marketers, online publishers, web hosts and more.
In these sites, this error usually comes up after a recent migration:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Today we’ll take a look at the top 5 reasons for this error, and how to fix them.
1. PHP’s MySQL extension not installed
PHP’s ability to send SQL commands to MySQL comes from an additional module called MySQL extension. In some default operating system setup, this extension might not be present.
To check if your PHP has MySQL support, put the following code into a file called info.php in your site, and access it from a browser.
It should show a MySQL section like this:
If not, you may have to install MySQL extensions.
In Ubuntu servers, use the command:
# apt-get install php5-mysqlnd
In RedHat compatible servers, use the command:
# yum install php-mysql
[ Website errors can drive your customers away. Click here to get an experienced server admin to monitor & maintain your server 24/7. ]
2. PHP extension directory mis-configured
In some websites, especially those that were recently migrated, or in a newly setup VPS, the “extension_dir” is sometimes misconfigured.
This directory stores all the PHP libraries, and if not set correctly, PHP cannot execute those functions.
To fix this, first locate which PHP.ini file is being loaded by your website. For this, put the following code into a file called info.php, and access it from a browser.
Look for the line called “Loaded Configuration File”. The file path noted there is the actual location to the PHP configuration file.
Now, look for the entry called “extension_dir“. It should either be commented, or it should have the correct path to PHP extensions. It should never be left blank.
If you are not sure, just comment the line, and restart the web server.