In this article, we will cover the most common reasons for the error Your PHP installation appears to be missing the MySQL extension which is required by WordPress and how it can be fixed.
Disabled extensions in Select PHP version
The MySQL extension refers to the PHP extension required for WordPress websites to communicate with the database. Thus, the first point to investigate is to check the PHP extensions enabled for your account.
For this purpose, log into your cPanel account and go to the
Select PHP Version menu:
Find mysqli (for PHP version 7.0 and higher) and mysql (for PHP version 5.6 and lower) and make sure they are checked:
Custom PHP versionIn case the required extension is enabled in your Select PHP Version menu, it is required to check if a separate PHP version is enabled for your website.
This can be done in the following way:
1. Navigate to the cPanel File Manager menu:
2. Find the .htaccess file of the addon domain in question. The steps to find it can be located
here.
3. Make sure that the correct SetHandler directive is present there. You can check code for Apache and LiteSpeed servers
here.
NOTE: In case your PHP was changed before the migration to LiteSpeed web server, your rule for Apache web server will not work and it will be required to change the rule to the LiteSpeed version.
php.ini configuration fileWhen a different PHP version is set for a domain, all the PHP extensions should be enabled manually in the
php.ini file. Thus, it is required to enable the mysql and mysqli extensions in your configuration file. For this purpose:
1. Navigate to the cPanel File Manager menu:
2. Proceed to the
public_html folder and press the
Edit button on the php.ini file:
3. Add the following lines to the file:
extension=mysql.so
extension=mysqli.so
It is possible to check if your PHP configuration includes the
mysql or
mysqli extension by setting up the phpinfo function as described
here.
Once the file is created, access your phpinfo page and look for the
mysql or
mysqli section:
WordPress and PHP incompatibilitySome old WordPress versions are designed to work with the mysql PHP extension that is available with PHP 5.6 and lower.
In case your website is based on outdated WordPress and the current PHP version is 7.0 or higher, it will be required either to change your PHP version to a lower version or to upgrade the WordPress installation so it becomes compatible with the current PHP version set for your website.
You can check how to change the PHP version
here.
That's it!
Need any help? Contact our HelpDesk