If your WordPress site shows the error Your PHP installation appears to be missing the MySQL extension which is required by WordPress, follow this guide to troubleshoot and resolve the issue.

Understanding the Issue

This error indicates that the MySQL extension is not loaded in your PHP configuration, which is necessary for WordPress to connect to the database.

Prerequisites

  • Access to your server via SSH.
  • Basic knowledge of terminal commands.
  • Plesk installed on CloudLinux.

Step 1: Verify MySQL Extension in Plesk

First, check that the MySQL extension is enabled in Plesk:

  1. Log in to Plesk.
  2. Navigate to Subscriptions > example_domain.com > PHP Selector > PHP 8.1.

Step 2: Check MySQL Extension via SSH

Run the following command to confirm if the MySQL extension is enabled in the PHP selector:

sudo selectorctl --list-extensions --version=8.1 | grep mysql

The expected output should include entries like:

- mysqli
+ mysqlnd
+ nd_mysqli
- nd_pdo_mysql
+ pdo_mysql

Step 3: Check PHP Configuration

Next, check if the MySQL extension is loaded directly in the CloudLinux PHP 8.1 environment:

sudo /opt/alt/php81/usr/bin/php-cgi -m | grep mysql

If the output is empty, it means the MySQL extension is not loaded. If loaded, you should see:

mysqli

Step 4: Verify MySQL Library Availability

Check if the MySQL library exists on the server:

sudo ls -la /opt/alt/php81/usr/lib64/php/modules | grep mysql

You should see output similar to:

lrwxrwxrwx 1 root root           39 Apr  5  2024 mysqli.so -> /opt/alt/php81/etc/mariadb103/mysqli.so
-rwxr-xr-x 1 root linksafe   243528 Sep 30 09:27 mysqlnd.so
-rwxr-xr-x 1 root linksafe   164544 Sep 30 09:27 nd_mysqli.so
-rwxr-xr-x 1 root linksafe    34248 Sep 30 09:27 nd_pdo_mysql.so
lrwxrwxrwx 1 root root           42 Apr  5  2024 pdo_mysql.so -> /opt/alt/php81/etc/mariadb103/pdo_mysql.so

Step 5: Confirm MySQL Extension is Enabled

Check the PHP configuration to ensure the MySQL extension is enabled:

sudo egrep -Ri mysql /opt/alt/php81/etc/php* | egrep ^extension

You should see entries like:

/opt/alt/php56/etc/php.d.all/mysql.ini extension=mysql.so

Cause of the Issue

Typically, this issue arises from a misconfiguration in CloudLinux PHP, where not all required alt-php packages are installed.

Resolution

If you purchased your licenses from WebHostingM, please contact our technical support for assistance with the PHP packages shipped by CloudLinux.

Disclaimer

Always ensure you have backups before making changes to your server configuration. For the latest documentation and support, refer to the official Plesk resources.

Did this answer help? 0 People found this helpful (0 Votes)