Articles in this section

Unable to install WordPress using Plesk WordPress Toolkit on CloudLinux : Call to undefined function json_encode()

kb: bug Plesk for Linux ext: wptk ABT: Group B

Applicable to:

  • Plesk for Linux

Symptoms

  • CloudLinux 7.x with LVE Manager and CageFS support is used

  • alt-php is enabled on the affected domain

  • When trying to install WordPress via the tab Domains > example.com > WordPress > Install, one of the following errors is shown:

    PHP Fatal error: Uncaught Error: Call to undefined function json_encode() in /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/mustache/mustache/src/Mustache/Engine.php:637

    Fatal error: Call to undefined function mysqli_connect() in /usr/local/psa/var/apspackages/c74e7822-0a26-42e8-9ea6-0c57a5edd8a9/cache/scripts/db-util.php on line 53

    Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `localhost:3306`. This could mean your host’s database server is down.

    Alternative error message with json decode

    PHP Fatal error: Uncaught Error: Call to undefined function json_decode() in /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/mustache/mustache/src/Mustache/Engine.php:637

  • There following error appears in Plesk:

    PLESK_ERROR: Unable to interact with the newly created WordPress instance. It may have become corrupted.

  • Cloning a WordPress instance fails with the following error message:

    PLESK_ERROR: Task is not responding: id=1331, pid=258404, type=ext-wp-toolkit-task\manage

  • There are the following records in /var/log/plesk/panel.log file:

    CONFIG_TEXT: DEBUG [util_exec] [1137da7ae7e29729c434a89b417517e6-0] Finished in 0.24553s, Error code: 0, stdout: Your PHP installation appears to be missing the MySQL extension which is required by WordPress., stderr:

Cause

This is Plesk bug with ID PPPM-7237, which is planned to be fixed in next product updates.

Resolution

Follow the article to be notified when the bug is fixed - the article will be updated.

As a workaround do the following:

Click on a section to expand

From Plesk interface
  1. Log into Plesk.

  2. Go to Tools & Settings > PHP Settings > alt-phpXX
    Where phpXX is version of PHP set up in for the affected domain under Plesk > Domains > example.com > PHP Selector.
  3.  Enable the following extensions:

    • mbstring
    • mysqli
    • json
    • propro
    • raphf
  4. Click OK.

Click on a section to expand

From SSH

Note: If direct SSH access to the server is not possible, contact the server administrator for further assistance.

  1. Connect to the server via SSH

  2. Edit the /opt/alt/phpXX/etc/php.d/default.ini file:

    Where phpXX is version of PHP set up in for the affected domain under Plesk > Domains > example.com > PHP Selector.

    Make sure that mbstring, json and mysqli modules are enabled.

    extension=mbstring.so <---- Uncomment this line
    ;extension=bcmath.so
    ;extension=dom.so
    extension=json.so <---- Uncomment this line
    ;extension=gd.so
    ;extension=posix.so
    ;extension=sockets.so
    ;extension=xmlreader.so
    ;extension=xmlwriter.so
    ;extension=zip.so
    ;extension=fileinfo.so
    ;extension=nd_mysqli.so <---- Comment this line
    extension=mysqli.so <---- Add a new line

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.