Why am I seeing a MySQL error on my Wordpress page?

LPTechs

New member
You happen to check your page one day and you see an error on your Wordpress site that says the following:


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

There is 1 thing to check before searching all over the internet for a solution.

1. Contact your hosting provider and ask what the version is for the operating system of the server your account is on.

Why is this the only thing you need to check? I will tell you.

If the Shared Server your account is on has an operating system of 7 or higher, there is a code in your .htaccess file that is no longer needed and causes the error listed above.

"How do I fix this?"

One solution (and the most common solution) is to log into your file system (through cPanel, FTP, etc.) and look for a file called ".htaccess." The most common place for this file is in your public_html directory. In your .htaccess file, you want to look for this line of code:

suPHP_ConfigPath /home/[USERNAME]/public_html

You want to remove this code from the .htaccess file and then save it. Keep in mind there could be mutliple .htaccess files and multiple suPHP codes in those files; make sure to look for them all. Once the code is removed, the website should be showing again.

"Why can I not see my .htaccess file?"

Most file systems actually hide your dot files from you. There is a setting you should be able to turn on that allows you to see them.
 
You happen to check your page one day and you see an error on your Wordpress site that says the following:


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

There is 1 thing to check before searching all over the internet for a solution.

1. Contact your hosting provider and ask what the version is for the operating system of the server your account is on.

Why is this the only thing you need to check? I will tell you.

If the Shared Server your account is on has an operating system of 7 or higher, there is a code in your .htaccess file that is no longer needed and causes the error listed above.

"How do I fix this?"

One solution (and the most common solution) is to log into your file system (through cPanel, FTP, etc.) and look for a file called ".htaccess." The most common place for this file is in your public_html directory. In your .htaccess file, you want to look for this line of code:

suPHP_ConfigPath /home/[USERNAME]/public_html

You want to remove this code from the .htaccess file and then save it. Keep in mind there could be mutliple .htaccess files and multiple suPHP codes in those files; make sure to look for them all. Once the code is removed, the website should be showing again.

"Why can I not see my .htaccess file?"

Most file systems actually hide your dot files from you. There is a setting you should be able to turn on that allows you to see them.

that will only work if the server provider uses suPHP on the servers
 
The main reason for the error is incompatibility if your PHP version on the server and website configuration.

You should always check the supported PHP version on your server where you are going to host the website and the configuration supported by your website.
 
If you are using WHM/cPanel and have WHM version 60 + then in the sites cPanel under software you will have 'MultiPHP Manager' where you can change the PHP version for a particular website, so rather than change the servers PHP version to say PHP 7.0 and have clients complain some of their sites are messed up as they only work with PHP 5.6, clients can decided to change the PHP version that suits their website
 
You happen to check your page one day and you see an error on your Wordpress site that says the following:


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

There is 1 thing to check before searching all over the internet for a solution.

1. Contact your hosting provider and ask what the version is for the operating system of the server your account is on.

Why is this the only thing you need to check? I will tell you.

If the Shared Server your account is on has an operating system of 7 or higher, there is a code in your .htaccess file that is no longer needed and causes the error listed above.

"How do I fix this?"

One solution (and the most common solution) is to log into your file system (through cPanel, FTP, etc.) and look for a file called ".htaccess." The most common place for this file is in your public_html directory. In your .htaccess file, you want to look for this line of code:

suPHP_ConfigPath /home/[USERNAME]/public_html

You want to remove this code from the .htaccess file and then save it. Keep in mind there could be mutliple .htaccess files and multiple suPHP codes in those files; make sure to look for them all. Once the code is removed, the website should be showing again.

"Why can I not see my .htaccess file?"

Most file systems actually hide your dot files from you. There is a setting you should be able to turn on that allows you to see them.


1. Connect via SSH and check the PHP version

To fix the problem, you should have SSH access to the server. Connect to your Linux VPS via SSH and check the PHP version which is currently in use:

php -v

2. Create Info.php file

You can also check the PHP version by creating a simple info.php file in your public_html directory with the following content:

<?php phpinfo(); ?>

Once you create the file, open your favorite web browser and access the file.

3. Update the required packages

If your are running an Ubuntu VPS and PHP 7, then run the following commands:

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

4. Restart the Web Server

Then restart your Apache service for the changes to take effect, or if you are using Nginx + PHP-FPM, then restart the PHP-FPM service.
5. Update PHP

In case you are running PHP 5, run the following commands:

apt-get update
apt-get install php-mysql

Restart the appropriate service for the changes to take effect.
6. Search all the available packages containing MySQL

To search all the available packages containing mysql, you can use this command:

apt-cache search mysql

On the other hand, if you are running a CentOS VPS and you have PHP 7 installed on the server, then run the following commands to fix the problem:

yum update
yum install php70w-mysql

7. Restart Apache

Restart Apache or the PHP-FPM service in case you are using Nginx + PHP-FPM as a web server.

If you have PHP 5 installed on your CentOS server, run the following commands:

yum update
yum install php-mysql

Restart the appropriate service for the changes to take effect.

To search all the available packages containing mysql, you can use the following command:

yum search mysql

Once you install the MySQL extension for PHP, you can return back to your WordPress setup. If the installation went OK, the message about the missing extension should not be presented to you. You can now continue with your WordPress setup.
 
Top