Symptoms

"Creating local pear installation for domain service" task fails:

Internal error: /usr/bin/pear /usr/bin/pear config-create /var/www/vhosts/9/100001 /var/www/vhosts/9/100001/.pearrc failed with code 255 saying: STDOUT: '' STDERR ''.

Cause

The value of open_basedir directive, defined in global PHP configuration file /etc/php.ini, prevents /usr/bin/pear binary from successful execution.

Resolution

There are several alternatives to resolve the situation, depending on the desired outcome:

  1. [Recommended] Include all paths required by Pear into open_basedir directive at TOP > Services > Web Hosting > NG Default Configuration > PHP Configuration > Language Settings > Edit open_basedir. The values of the following directives should be present to allow Pear scripts execution:

    include_path
    upload_tmp_dir
    session.save_path
    

    The values can be found inside /etc/php.ini file on any NG web server.

  2. The below solution does not imply changing global open_basedir configuration, but requires getting re-applied upon each php-pear package update, since /usr/bin/pear gets replaced with the default one.

    Correct /usr/bin/pear script and pass an empty open_basedir parameter to it:

    # cat /usr/bin/pear
    
    #!/bin/sh
    exec /usr/bin/php -C -d include_path=/usr/share/pear -d open_basedir="" \
        -d output_buffering=1 /usr/share/pear/pearcmd.php "$@"
    

    In case open_basedir restriction is still required for Pear (to achieve maximum security), pass the required directories together with PATH variable:

    # cat /usr/bin/pear
    
    #!/bin/bash
    PATH=/usr/bin:/usr/share:/usr/libexec/php4-cgi/bin exec /usr/bin/php -C -d include_path=/usr/share/pear \
        -d date.timezone=UTC \
        -d output_buffering=1 -d open_basedir=/usr/bin:/usr/share:/usr/libexec:/etc:/tmp:/root /usr/share/pear/pearcmd.php "$@"
    
  3. [Unsecure] Remove the global PHP open_basedir settings at all.

Internal content