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.
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?
- What Does The Error “Your PHP installation appears to be missing the MYSQL extension which is required by WordPress” Mean?
- 5 Ways To Solve “Your PHP installation appears to be missing the MYSQL extension which is required by WordPress”
- How To Check If You Install PHP MySQL Extension Correctly
- Still Having Trouble? Here’s A Few More Things To Check
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:
- Open a terminal or SSH connection to your server.
- 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
Replacex
with the version of PHP installed on your server. - 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:
- Log in to WHM as the root user.
- Navigate to the “Software” section and click on “EasyApache 4”.
- Select your current Apache configuration and click on the “Customize” button.
- Click on the “PHP Extensions” tab.
- In the search bar, type “mysqli” or “mysqlnd” to locate the PHP MySQL extension.
- Check the box next to the “mysqli” or “mysqlnd” extension to enable it.
- Click on the “Review” button to review the changes.
- 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:
- Log in to your cPanel account.
- In the “Software” section, click on “Select PHP Version”.
- In the top right corner, click on the “Switch to PHP Options” button.
- 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.
- Click on the “Save” button at the bottom of the page to apply the changes.
If you learn by watching, check out our video on this process.
#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:
- Log in to your NodeWorx account.
- Click on “Server” in the main menu and select “PHP Configuration Editor”.
- Select the PHP version you want to configure from the dropdown menu at the top of the page.
- 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.
- Check the boxes next to the “mysqli” and “mysqlnd” extensions to enable them.
- 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:
- Log in to your SiteWorx account.
- Click on “PHP Settings” under the “SiteWorx” section.
- Click on the “PHP Modules” tab.
- 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.
- Check the boxes next to the “mysqli” and “mysqlnd” extensions to enable them.
- 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.
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.
An ambitious Linux programmer whose been in web hosting for 6 years, currently working at as a Linux System Administrator. I’ve designed WordPress, Drupal and Joomla sites through contract work or on my break from working too much. Work-a-holic and tend to be connected almost 24/7 (I like it). I really enjoy creating automation scripts as it tends to make life easier. My goal is dive into the world of DevOps and be able to manage datacenters.
Munashe Tombo says
This is very helpful, once experienced that error. Now solved. But can you also explain or document how to fix style sheet error in WordPress.