Plesk

WP Toolkit shows WordPress instance as broken when a domain is using Alt-PHP: Error establishing a database connection

Symptoms

Cause

PHP extensions like json.so and mysqli.so for Alt-PHP are disabled.

Resolution

Apply one of the following workarounds:

 

Create a symbolic link for mysql socket

 

  1. Connect to the Plesk server via SSH.

  2. Create a symbolic link:

    # ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

 

Enable additional extensions in PHP configuration

 

  1. Log in to Plesk.

  2. Go to Domains > example.com > PHP Settings.

  3. Add the following lines to the Additional configuration directives field:

    extension=json.so
    extension=mysqli.so
    extension=pdo_mysql.so

    Note: If the error "Module 'mysqli' already loaded at Unknown#0" is shown when accessing domains, disable the above extensions at Domains > example.com > PHP Selector.

 

Change Alt-PHP to PHP provided by Plesk

 

  1. Log in to Plesk.

  2. Go to Domains > example.com > PHP Settings.

  3. Change PHP handler to any non Alt-PHP.

  4. Go to Domains > example.com > WordPress.

  5. On the affected WordPress instance, click > Detach.

  6. Click Scan to detect the instance.