Connect with us

Tips and Guides

How To Fix The “Your PHP installation appears to be missing the MYSQL extension which is required by WordPress” Error

Published

on

How To Fix The “Your PHP installation appears to be missing the MYSQL extension which is required by WordPress” Error

In this article, we’ll talk about a few different ways that you can fix this error by enabling the MySQL extension on your server using the command line, cPanel, WHM, SiteWorx, or NodeWorx. We’ll also cover how to confirm that the installation was successful, and if you’re still having errors, we’ll show you what else to check.

This image has an empty alt attribute; its file name is image-4-1024x119.png

After completing these steps, WordPress should be able to connect to your MySQL database. Without the PHP MySQL extension, PHP would not be able to communicate with MySQL databases. This would severely limit the functionality of PHP-based applications that require database access, such as WordPress. Let’s start with the basics.

What Is The PHP MySQL Extension?

The PHP MySQL extension is a module that provides a set of functions for PHP to connect to and interact with MySQL databases. These functions allow PHP to establish a connection to the database server, execute SQL queries, retrieve query results, and perform other database-related tasks.

Fortunately, the PHP MySQL extension is widely available and easy to install. Most web hosting providers include the extension as part of their standard PHP installation, and it can be installed on a server manually if needed. Once installed, the extension allows PHP to communicate with MySQL databases and enable powerful database-driven web applications.

What Does The Error “Your PHP installation appears to be missing the MYSQL extension which is required by WordPress” Mean?

This error message typically indicates that the PHP MySQL extension is not installed or enabled on your server. So how do you install or enable it? There are a few different ways…

5 Ways To Solve “Your PHP installation appears to be missing the MYSQL extension which is required by WordPress”

To resolve this issue, you will need to install the PHP MySQL extension. There are five different ways to install the extension.

#1: Install the PHP MySQL Extension Via The Linux Command Line

Here are the steps to install it on a typical Linux-based server:

Advertisement
  1. Open a terminal or SSH connection to your server.
  2. Run the following command to install the PHP MySQL extension:

    For PHP 8.x:
    sudo yum install php8.x-mysql

    For PHP 7.x:
    sudo yum install php7.x-mysql

    For PHP 5.x:
    sudo yum install php5.x-mysql

    Replace x with the version of PHP installed on your server.
  3. Once the installation is complete, restart your web server to enable the extension. For example, if you’re using Apache, you can use the following command:

    sudo service apache2 restart

sudo service httpd restart

Disclaimer, may need to have your web host provider or admin run this commands as it installs extensions globally.

#2: Install the PHP MySQL Extension Via Web Host Manager (WHM)

If you have access to WHM (Web Host Manager), you can install the PHP MySQL extension using the EasyApache tool. Here are the steps to install the extension via WHM:

  1. Log in to WHM as the root user.
  2. Navigate to the “Software” section and click on “EasyApache 4”.
  1. Select your current Apache configuration and click on the “Customize” button.
  2. Click on the “PHP Extensions” tab.
  3. In the search bar, type “mysqli” or “mysqlnd” to locate the PHP MySQL extension.
  4. Check the box next to the “mysqli” or “mysqlnd” extension to enable it.
In this case, the server has Cloudlinux installed, by default, it will use cpanel repository.
  1. Click on the “Review” button to review the changes.
  2. Click on the “Provision” button to apply the changes and install the extension.

#3: Install the PHP MySQL Extension Via cPanel

If you are using cPanel to manage your web hosting account, you can install the PHP MySQL extension through the cPanel interface. Here are the steps to install the extension via cPanel:

  1. Log in to your cPanel account.
  2. In the “Software” section, click on “Select PHP Version”.
  3. In the top right corner, click on the “Switch to PHP Options” button.
  4. Look for the “mysqli” and “mysqlnd” extensions in the list and ensure that they are checked. If they are not, check the boxes next to them to enable them.
  5. Click on the “Save” button at the bottom of the page to apply the changes.

#4: Install the PHP MySQL Extension Via NodeWorx

If you have access to the NodeWorx interface in InterWorx, you can install the PHP MySQL extension using the PHP Configuration Editor. Here are the steps to install the extension via NodeWorx:

  1. Log in to your NodeWorx account.
  2. Click on “Server” in the main menu and select “PHP Configuration Editor”.
  3. Select the PHP version you want to configure from the dropdown menu at the top of the page.
  4. Look for the “mysqli” and “mysqlnd” extensions in the list. If they are not listed, click on the “Show All” button to display all available extensions.
  5. Check the boxes next to the “mysqli” and “mysqlnd” extensions to enable them.
  6. Click on the “Save Changes” button at the bottom of the page to apply the changes.

#5: Install the PHP MySQL Extension Via SiteWorx

You can also do it from within Siteworx too! Here are the steps to install the extension via SiteWorx:

  1. Log in to your SiteWorx account.
  2. Click on “PHP Settings” under the “SiteWorx” section.
  3. Click on the “PHP Modules” tab.
  4. Look for the “mysqli” and “mysqlnd” extensions in the list. If they are not listed, click on the “Show More” button to display additional modules.
  5. Check the boxes next to the “mysqli” and “mysqlnd” extensions to enable them.
  6. Click on the “Save” button at the bottom of the page to apply the changes.

How To Check If You Install PHP MySQL Extension Correctly

Once you have completed these steps, the PHP MySQL extension should be installed and enabled on your server. You can verify this by creating a PHP script with the following code:

<?php phpinfo(); ?>

The file can be named anything but needs to end with “.php”. This script will display detailed information about your PHP installation, including a list of enabled extensions. If the MySQL extension is installed and enabled, it should be listed in the output of the phpinfo() function.

Still Having Trouble? Here’s A Few More Things To Check

If you already have PHP and the MySQL extension installed, but you are still getting the error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”, there may be a few reasons for this:

The MySQL extension is not enabled

Even though the MySQL extension is installed, it may not be enabled in your PHP configuration. You can check your PHP configuration to see if the extension is enabled.

Advertisement

If the MySQL extension is not listed, you need to enable it in your PHP configuration.

The MySQL extension is not compatible

If you have updated your PHP version recently, the MySQL extension may no longer be compatible with your new version of PHP. In this case, you may need to switch to a different MySQL extension, such as “mysqli” or “PDO MySQL”.

The MySQL server is not running

If your MySQL server is not running or is not properly configured, PHP will not be able to establish a connection to it. You may need to start or restart the MySQL server and make sure it is properly configured.

In any case, it is recommended to check the error logs on your server to get more information about the specific issue you are experiencing. The error logs should give you more details about what is causing the problem and how to fix it.

Advertisement

Stephen Oduntan is the founder and CEO of SirsteveHQ, one of the fastest growing independent web hosts in Nigeria. Stephen has been working online since 2010 and has over a decade experience in Internet Entrepreneurship.

Continue Reading
Advertisement
Comments

Trending

Copyright © 2024 SirsteveHQ. All Rights Reserved.