Fix your PHP installation appears to be missing the MySQL extension error

One of the common errors that occurred while installing WordPress on a new VPS is Your PHP installation appears to be missing the MySQL extension error. This error occurs when MySQL extension doesn’t exist on the VPS. By default, many operators don’t have this extension.

If you face this error while working on your WordPress website, you don’t need to worry about it. There are many other reasons for this error. A lot of WordPress users deal with this issue.

In this article, we discuss 5 easy ways to fix this error. By following the steps below, you can fix “Your PHP installation appears to be missing the MySQL extension” error.

In our previous article, we discussed how to increase PHP memory in WordPress.

How to Fix ‘Your PHP installation appears…’ Error

As mentioned above, in this article, we introduce 5 methods to fix Your PHP installation appears to be missing the MySQL extension error.

1. Check and install PHP MySQL extension

By default, PHP MySQL extension doesn’t exist on most system operators. PHP uses this module to send commands to SQL and receive them from MySQL.

To install PHP MySQL extension, you need to create an info.php file.

To do so, you need to download Notepad++ and launch it. Copy and paste the code below and save the file as info.php:

<?
phpinfo();
<?

Upload the saved file in your root directory.

To install PHP, open http://www.yourdomainname.com/info.php in your browser.

Go to MySQL Support. If you have MySQL installed, its version is displayed next to the Client API version. If you haven’t installed MySQL, follow the steps below:

Install PHP MySQL on servers compatible with RedHat or Ubuntu

Based on your PHP version, run the commands below. Keep in mind, commands below only work if your server is compatible with RedHat.

Version 5:

#yum update
#yum install php-mysql

Version 7:

#yum update
#yum install php70w-mysql

Run Apache or PHP-FPM.

To fix Your PHP installation appears to be missing the MySQL extension error in Ubuntu servers, run the commands below. Commands are different for each PHP version:

Version 5:

#apt-get update
#apt-get install php5-mysqlnd

Version 7:

#apt-get update
#apt-get install php7.0-mysql

Rerun the server and check if the error is gone.

2. Review MySQL extension directory configuration

Sometimes by following the steps mentioned above, you still get Your PHP installation appears to be missing the MySQL extension error. This error could happen if your MySQL extension directory has the wrong configuration. This occurs when you transfer your WordPress website or use a new VPS. To fix this issue, you need to check the “extension_dir” in your PHP.ini file.

Open the info.php file you created in the previous step. Look for “Loaded Configuration File” parameter and copy its value. For example:

Your PHP installation appears to be missing the MySQL extension

Now check the “extension_dir” section. Make sure the PHP extension is not empty or it has the correct path. For example:

Your PHP installation appears to be missing the MySQL extension

Compare “Loaded Configuration File” and “extension_dir” parameters with each other. If your “extension_dir” value is different to your PHP version path, make sure you correct it. To do so, type in the correct path in your PHP.ini file.

3. Make sure MySQL.so and MySQL.DLL files exist

The PHP.ini file is customized in some websites. This file won’t be updated when you update your PHP or transfer your server. On the other hand, in files like PHP.ini, you may misspell extension directory paths.

The best solution to this issue is to delete the lines below or convert them to comments in your PHP.ini file:

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

4. Check php-mysqlnd-ms packages in Ubuntu servers

Your PHP installation appears to be missing the MySQL extension error also occurs in the newer versions of Ubuntu system operator. Because Ubuntu uses local MySQL drives instead of using the old PHP library. Installing php5-mysqlnd-ms package can fix this error. To do so, run the command below:

#apt-get install php5-mysqlnd-ms

To check for all packages that include MySQL, run the following command:

Ubuntu:

#apt-cache search mysql

RedHat:

#yum search mysql

5. Check PHP configuration from suPHP_CinfigPath

PHP files that are personalized are uploaded with suPHP_CinfigPath. However, this ability is available to servers with suPHP enabled.

If these files are configured in the .htaccess file, you can easily fix this error. This error is due to entering values that are different from MySQL extension values. Especially in shared servers like Plesk, cPanel, and WHM.

To fix this error, you need to deactivate suPHP_ConfigPath in .htaccess file. If Your PHP installation appears to be missing the MySQL extension error isn’t fixed, you need to check your PHP.ini file.

Check the values in PHP.ini and correct them.

Conclusion

In this article, we discussed Your PHP installation appears to be missing the MySQL extension error.

We learned that this error usually occurs when you update your PHP or transfer your website to another server. With 5 easy methods, we can fix this error. We checked the PHP.ini configuration to fix this error. In addition, we learned how to check different packages in Ubuntu and R

The post Fix your PHP installation appears to be missing the MySQL extension error appeared first on BetterStudio.

Go to source

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.