bobcares-rss-icon

Tried and tested solutions for your servers, from our outsourced support diaries.

5 reasons for error “Your PHP installation appears to be missing the MySQL extension” and how to fix it

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.

See how we can support your websites!

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.


Is your website stable and unique for your business?

Don't let a poor website design or site errors affect your business. We're here to help you.

CLICK HERE TO GET AN ERROR-FREE SITE

4 Comments

  1. Thanks for the help!

    /* in my setup, your code

    doesn’t work. I had to write

    instead.
    */

    Reply
  2. Got this error. It wound up being the Hosting company at fault.
    My PHP version was switched to Version 7. I put it back to V5.6 (I think) and my website came back to life.

    (time to upgrade my wordpress as have not done the last few)

    Reply
    • Thank you Jim for sharing. 🙂

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

About Bobcares

Bobcares Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services.
Our engineers manage close to 52,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES
Bobcares
WE RESCUE AND MANAGE YOUR SERVER 911 SUPPORT . MONITORING . MAINTENANCE Our experts are online 24/7 to help you recover from a server issue, or to assist you with complex server admin jobs.
GET STARTED