How to Fix “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”

Introduction

If you are seeing the error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress,” it means that your web server is not properly configured to run WordPress. This error can be caused by a number of different issues, but fortunately, it is usually easy to fix. In this guide, we will show you how to fix the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error. We will cover the most common causes of this error and provide step-by-step instructions on how to fix them.

How to Fix “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”

1. Check your php.ini file

The first step is to check your php.ini file to make sure that the MySQL extension is enabled. To do this, open the php.ini file in a text editor and search for the line “extension=mysql.so”. If the line is commented out (i.e. preceded by a semicolon), then you need to uncomment it by removing the semicolon.

2. Restart your web server

Once you have made the change to your php.ini file, you need to restart your web server for the changes to take effect.

3. Check your phpinfo()

Once your web server has been restarted, you can check your phpinfo() to make sure that the MySQL extension is now enabled. To do this, create a new file called “phpinfo.php” and add the following code:

Save the file and then open it in your web browser. You should now see a page with information about your PHP installation. Look for the section labeled “MySQL” and make sure that it is enabled.

If the MySQL extension is still not enabled, then you may need to contact your web hosting provider for assistance.
[ad_1]

Introduction

WordPress is a stable platform. But one of the most common errors is “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” This happens when your site’s PHP code is not compatible with the PHP version the site is running on.

In this guide, we will resolve the PHP error related to the missing MySQL extension in WordPress.

Your PHP installation appears to be missing the MySQL extension which is required by WordPress tutorial for fixing

Prerequisites

  • Access to the server that hosts the WordPress installation (local or SSH)
  • A user account with sudo privileges
  • Access to a command-line/terminal window (optional)
  • A package manager (like yum or apt)

Update WordPress

Updating WordPress to fix php error

Several isssues can cause the WordPress error missing mysql extension. You can resolve many of them by running an update in the WordPress admin.

To update WordPress:

  1. Log into the wp-admin page of your website, for example, https://examplesite.com/wp-admin/
  2. Click the Updates link in the upper-left corner. The page displays available updates.
  3. Click the Update Now button.

If your installation is up-to-date, WordPress offers an option to reinstall the current version.

WordPress is designed to disable plugins before updating. You can also manually disable any plugins first. Make sure you always update your WordPress installation before updating any plugins.

Check PHP Version on your Server

Log in to the server that hosts your WordPress site, either locally or via SSH. Check the PHP version with the command:

php –v

The system displays the version of the installed PHP software as shown below.

ubuntu terminal php -v command showing the installed PHP version

You can also browse the /public_html directory where your WordPress content is stored. Create a new file named info.php, then open it in an editor.

Enter the following line in the file:

<?php phpinfo(); ?>

Save the file and exit. Now you can load the file in a web browser, and the page will display a long list of all the details.

Check PHP MySQL Extension is Installed

Look through the info.php file we created in the previous section. Under the MySQL Support, find the Client API version cell check the PHP version.

Checking the PHP version in the MySQL support section in the info.php file

Tip: Use Ctrl+F and type MySQL Support to find this section instead of scrolling through the file.

If the Client API Version field is blank, you may be missing MySQL extensions for PHP. Enter the following commands to install them:

Ubuntu:

sudo apt-get update
sudo apt-get install php5-mysqlnd

Red Hat/CentOS:

sudo yum update
sudo yum install php-mysql

Restart the server to apply the changes.

Note: If you are running PHP7.x, replace the commands accordingly.

Check PHP Extension Configuration

If you’ve run any updates or migrated your website, there may be a mismatch in the PHP configuration in the extension_dir where WordPress looks for PHP data. On your PHP info webpage, find the Loaded Configuration File entry with the path to the php.ini file. The line may look something like this:

/opt/imh/imh-php56/root/usr/lib/php/php.ini

This is the location where your server stores PHP configuration.

Next, find the extension_dir entry in the info.php file you loaded in the browser. The line should be commented or contain a valid path to PHP extensions :

/opt/php56/lib/php/extensions/no-debug-non-zts-20131226

If it’s blank, edit the php.ini file:

sudo nano /opt/imh/imh-php56/root/usr/lib/php/php.ini

Scroll down to the extension_dir setting, and either update it to match your actual extension directory, or comment it out. Once you finish, save and exit, then restart your web server.

Tip: To mark a line as a comment, start the line with a semicolon ;

Wrong Filename or Path for MySQL.so or MySQL.dll

If you’re using a customized php.ini file, it does not always get updated when you migrate or upgrade your installation. In this case, you need to edit the php.ini file. Use a coding text editor and add the path to the file, for example:

sudo nano /opt/imh/imh-php56/root/usr/lib/php/php.ini

Find and comment the following lines:

; extension=mysql.so
; extension_dir=/path/to/extensions/

Save the file and exit, then restart your server and test.

Missing php-mysqlnd-ms Packages (Ubuntu)

Recent versions of Ubuntu operating systems use native MySQL drivers instead of the old PHP libraries. In this case, when the php5-mysqlnd-ms package is missing, the error Your PHP installation appears to be missing the MySQL extension which is required by WordPress may appear.

Install the package by using the following command:

sudo apt-get install php5-mysqlnd-ms

When finished, restart your server and test.

Check for Other PHP Customizations

If you’ve tried all these steps and you still get the “Your PHP installation appears to be missing the MySQL extension” error, you can look at the customized configuration files.

Open your .htaccess file with a full path of your website:

sudo nano path_to_your_website/public_html/.htaccess

Go through and check the version of PHP that’s referenced. It must be the same version of PHP that you checked previously in your info.php file.

If everything looks good in .htaccess, do the same thing for your php.ini file. Again, you’re looking for references to a different PHP version than your info.php file showed.

Change the referenced version or remove that section from the file. Save the changes to the file, exit, and then restart your server.

Note: If you are using customized .htaccess and php.ini files, test your WordPress installation with default versions of these files. You can rename them .htaccess.bak and php.ini.bak to disable them. Then, either copy your backup default versions or download fresh ones.

Conclusion

This tutorial listed several options to fix the error “Your PHP installation appears to be missing the MySQL extension.” Typically, loading the missing MySQL extension for PHP resolves the issue.

[ad_2]

How to Fix “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”

If you are trying to install WordPress and you get the error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress,” then you are not alone. This is a common issue that can be easily fixed.

Step 1: Check Your PHP Version

The first step is to check your PHP version. WordPress requires PHP version 5.6.20 or higher. To check your version, open your web server’s control panel and look for the PHP version. If it is lower than 5.6.20, you will need to upgrade your PHP version.

Step 2: Install the MySQL Extension

Once you have upgraded your PHP version, you will need to install the MySQL extension. This can be done by downloading the MySQL extension from the PHP website and then adding it to your php.ini file. Once you have added the extension, you will need to restart your web server for the changes to take effect.

Step 3: Check Your WordPress Installation

Once you have installed the MySQL extension, you can check your WordPress installation to make sure it is working properly. To do this, open your web browser and navigate to your WordPress site. If everything is working correctly, you should be able to access your WordPress dashboard.

Conclusion

Fixing the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error is a relatively simple process. All you need to do is check your PHP version, install the MySQL extension, and then check your WordPress installation. Once you have done this, you should be able to access your WordPress dashboard without any issues.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00