🛠️Fix “Missing MySQL Extension” Error in WordPress

Environment:
CloudLinux + mod_lsapi
Error:

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

Cause

This issue can occur on CloudLinux servers using mod_lsapi when PHP 7 is not properly registered in Apache’s handler configuration. As a result, WordPress cannot detect the MySQL extension.


Solution

Step 1: Edit lsapi.conf

Open the configuration file:

nano /etc/apache2/conf.d/lsapi.conf

Make sure the following line is present:

AddHandler application/x-httpd-lsphp .php .php4 .php5 .php53 .php54 .php55 .php56 .php6 .php7 .phtml

If the line already exists but lacks .php7, append .php7 to the list.


Step 2: Restart Apache

Run the following command to restart the Apache web server:

service httpd restart

Result

The WordPress site should now load properly without the MySQL extension error.


Tip:
You can also verify the PHP handler with:

/usr/local/cpanel/bin/rebuild_phpconf --current

And to apply system default settings (if needed):

/usr/local/cpanel/bin/rebuild_phpconf --default

Note:
Ensure the PHP MySQL extensions like mysqli or pdo_mysql are installed in the relevant PHP version via WHM » EasyApache 4 or by checking:

php -m | grep -i mysql
Scroll to Top