5 reasons for error “Your PHP installation appears to be missing the MySQL extension” and how to fix it
Newly migrated WordPress sites often face a lot of compatibility errors. One common one is:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Bobcares helps website owners and web hosting providers fix application errors, and this error is often reported at our Website Administration Services.
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.
<? phpinfo(); ?>
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
[ Are your websites helping you get business? Our website support team gives you custom website solutions and fix all errors in your website in no time. ]
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.
<? phpinfo(); ?>
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.