Select Page

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

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.

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
[ 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.

<?
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.


PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

11 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
    • Thank you, this helped me too.

      Reply
      • Jimako,

        Good to hear from you 🙂

        Reply
  3. Thanks a lot! In my case, the 5º (of course :D) solved the problem!

    Reply
    • Juliano,

      Good to know that 🙂

      Reply
  4. I was simply reading an article that was written on WordPress. I didn’t finish it and went back a couple of times to keep reading. After turning my computer off for an evening, when I turned it back on this error was written in place of the article. I don’t have WordPress, I was simply reading the article which was there for several days before I received this error message. What’s going on. I don’t have a clue what PHP or MySQL are nor am I trying to write on WordPress. Just a reader of an article. Thanks.

    Reply
    • WordPress sites store the content in a database. When the site is unable to connect to the database to retrieve the content, this error is shown.

      Unless it is your site, you don’t have anything to worry about. The site owners will get it fixed through their web hosting providers.

      If this is indeed your site, it looks like the PHP installation in the server must have been recently upgraded or changed. It may need to be reconfigured. Please contact us by clicking here if you need assistance with your website.

      Reply
  5. Commented out – extension_dir = ./ – WORKED THANK YOU!!
    register_globals = off
    allow_url_fopen = off

    expose_php = Off
    max_input_time = 60
    variables_order = “EGPCS”
    ;extension_dir = ./
    upload_tmp_dir = /tmp
    precision = 12

    Reply

Submit a Comment

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

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES

Privacy Preference Center

    Necessary

    Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

    PHPSESSID - Preserves user session state across page requests.

    gdpr[consent_types] - Used to store user consents.

    gdpr[allowed_cookies] - Used to store user allowed cookies.

    PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
    PHPSESSID
    WHMCSpKDlPzh2chML

    Statistics

    Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

    _ga - Preserves user session state across page requests.

    _gat - Used by Google Analytics to throttle request rate

    _gid - Registers a unique ID that is used to generate statistical data on how you use the website.

    smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

    _ga, _gat, _gid
    _ga, _gat, _gid
    smartlookCookie

    Marketing

    Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

    IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

    test_cookie - Used to check if the user's browser supports cookies.

    1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

    NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

    DV - Google ad personalisation