What's new

Welcome to ServerProofs

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Namecheap - How to fix Your PHP installation appears to be missing the MySQL extension which is required by WordPress

In this article, Namecheap will cover the most common reasons of Your PHP installation appears to be missing the MySQL extension which is required by WordPress error, and how it can be fixed.

Disabled extensions in Select PHP version​

MySQL extension refers to the PHP extension that is 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:

For cPanel Basic Theme:

select_php_basic_cpanel.png


For cPanel Retro theme:

select_php_old_cpanel.png


Find mysqli (for PHP version 7.0 and higher) and mysql (for PHP version 5.6 and lower) and make sure they are checked:

mysqli_check.png


Custom PHP version​

In 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:

For cPanel Basic theme:

file_manager_icon_basic.png



For cPanel Retro theme:

file_manager_icon_retro.png


2. Find the .htaccess file for the addon domain in question. The steps for how to find it can be located here.​
3. Make sure that the correct SetHandler directive is present there.

NOTE: In case your PHP was changed before the migration to the LiteSpeed web server, your rule for the Apache web server will not work and it will be required to change the rule to the LiteSpeed version.

php.ini configuration file​

When a different PHP version is set for the domain, all the PHP extensions should be enabled manually in the php.ini file. Thus, it is required to enable mysql and mysqli extensions in your configuration file. For this purpose:​

1. Navigate to the cPanel File Manager menu:

For cPanel Basic theme:

file_manager_icon_basic.png



For cPanel Retro theme:

file_manager_icon_retro.png

2. Proceed to the public_html folder and press Edit button on the php.ini file:

phpini_edit.png


3. Add the following lines to the file:

extension=mysql.so
extension=mysqli.so

Once the file is created, access your phpinfo page and look for mysql or mysqli section:​

phpinfo_check_mysqli.png

WordPress and PHP incompatibility​

Some 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 an outdated WordPress and the current PHP version is 7.0 or higher, it will be required to either change your PHP version to a lower one or upgrade the WordPress installation so it becomes compatible with the current PHP version set for your website.

That's it!​
 

Top resources

Top Bottom