Error : Your PHP installation appears to be missing the MySQL extension which is required by WordPress

I’m new to wordpress. After uploading the website i’m facing this error. The site worked well for a while and then this happened. Upon entering the URL this text appears “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”.
Went to php.ini but couldnt find what to uncomment. Please advise in the best way possible.
Server – Xampp

Related posts

7 comments

  1. The error you got Your PHP installation appears to be missing the MySQL extension which is required by WordPress is because you’re server is not having the MySQL Extension which is required for WordPress to run

    If you are using Windows Based Operating System then you should enable the mysql extension in your xampp

    i.e., You should uncomment the following lines in your php.ini

    extension=php_mysql.dll
    

    Or If you use Linux based Operating System then you should install mysql from the Terminal by

    sudo apt-get install php5-mysql
    

    and then uncomment the following line in you php.ini

    extension=mysql.so 
    

    Note :

    1. What ever the Operating System you use, You should restart / stop and start your Xampp Server after uncommenting the php.ini file

    2. If you’re working online then you should contact your host provider to enable the MySQL Extension for your Account.

  2. In Windows, you need to setup your php.ini like this:

    • uncomment the line extension=php_mysqli.dll

    • find the “extension_dir” parameter and set the path to ext directory of your php installation, like this:

      extension_dir = “c:/php56/ext”

  3. This answer is specific to those who use HostGator for their WordPress site, but the premise is still the same as for which files to manipulate, steps 1-3 will just be different for you to get to the correct files with your specific Host.

    Here is how I fixed this error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress. Deprecated: Directive ‘allow_url_include’ is deprecated in Unknown on line 0

    1. Get access to Hosting Platform (HostGator for my site)
    2. Launch cPanel
    3. File Manager
    4. Double Click public_html
    5. Right Click .htaccess
      • Copy, give name ‘/public_html/.htaccess.bak’ , creating a backup
    6. Right Click .htaccess
      • Edit, go in and at the bottom the following code will have your current PHP handler:
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php74” package as the default “PHP” programming language.
    <IfModule mime_module>
      AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
    
    • Scroll up, either right above the previous handler or at the top, you may have an old PHP handler:
    # Use PHP70 as default
    AddHandler application/x-httpd-php70 .php
    <IfModule mod_suphp.c>
        suPHP_ConfigPath /opt/php70/lib
    </IfModule>
    
    • Comment out this code, to inactivate the old handler:
    # Use PHP70 as default
    #AddHandler application/x-httpd-php70 .php
    #<IfModule mod_suphp.c>
    #    suPHP_ConfigPath /opt/php70/lib
    #</IfModule>
    
    • Save those changes (We added in hashtags at the start of each line to comment the code out)
    1. If the site still is not functional, We must make the same exact changes to the .htaccess file that is one level outside of the public_html directory.
    • Perform the same steps as before on this .htaccess file, creating a backup and commenting out the old handler.
    • This more global file may only have the old handler, so the file may just look like this:
    # Use PHP70 as default
    AddHandler application/x-httpd-php70 .php
    <IfModule mod_suphp.c>
           suPHP_ConfigPath /opt/php70/lib
    </IfModule>
    
    • If that is the case, go back and copy the code from the new handler that we just made active in the ‘/public_html/.htaccess’ file
    • Also comment out the old handler once again.

    This should fix the issue once you save those changes.

  4. Login to your c panel
    Got to PHP Configuration
    Select your current PHP Version ( You can know this from phpinfo)
    Click update

  5. In the folder where you have installed the php, try to find the “php.ini”. Now you should have delete the ” ; ” from this rows.

     ; extension=mysqli
     ; extension=pdo_mysql
    
  6. At first create a PHP file on your PHP server then put the simple code here and run for check your php server informations

    <?php phpinfo(); ?>
    

    Check your PHP version and install PHP MySQL extension

    sudo apt-get install phpX.X-mysqli
    sudo apt-get install php8.1-mysqli
    sudo apt-get install php7.4-mysqli
    

    When it is done, simply restart your server.
    For nginx server

    valet restart
    

    For apache server

    sudo systemctl restart apache2
    

    Or restart your computer.

    enter image description here

  7. To solve this problem is to config this WordPress file wp-config-sample.php form your WordPress folder on your machine which looks like this C:xampphtdocswordpresswp-config-sample.php

    enter image description here

    Then you save it as wp-config.php reload your browser every thing should work well.

Comments are closed.