skip to Main Content

As the title says, how do I add a path to the open_basedir in Plesk for all domains?

I have to change the open_basedir value for all domains from:

{DOCROOT}/:/tmp/

to:

{DOCROOT}/:/tmp/:/var/www/vhosts/{DOMAIN?}/

I know where to do it, I just don’t know what the variable is for the parent of {DOCROOT}

2

Answers


  1. I don’t know about Plesk 10.3, but in Plesk 10.4 there is {WEBSPACEROOT} which exposed to /var/www/vhosts/%domain-name%/. So, you just need to replace “{DOCROOT}/:/tmp/” to “{WEBSPACEROOT}/:/tmp/” in PHP settings of Service Plan.

    And it’s a default settings in Plesk 11.0.

    For Plesk 10.0, for case when php works as Apache module:

    mkdir /usr/local/psa/admin/conf/templates/custom/service/
    cp /usr/local/psa/admin/conf/templates/default/service/php.php /usr/local/psa/admin/conf/templates/custom/service/
    

    in /usr/local/psa/admin/conf/templates/custom/service/php.php replace strings

    echo "php_admin_value open_basedir {$OPT['dir']}/:/tmp/n";
    

    to

    echo "php_admin_value open_basedir " . str_replace('/httpdocs', '', $OPT['dir']) . "/:/tmp/n";
    

    and run:

    /usr/local/psa/admin/bin/httpdmng --reconfigure-all # to apply new configuration for all domains
    

    But for CGI and FastCGI there is need to change /var/www/vhosts/domain-name/etc/php.ini file and I don’t know how deal with it.

    Login or Signup to reply.
  2. I’ve used the Oleg’s solution for php.php template at plesk 11 and just changed the following code:

    echo $OPT['settings'];
    

    to

    echo str_replace(':/tmp/', ':/tmp/:/php/includes/', $OPT['settings']);
    

    This is not a very robust solution as can made more option replaces than needed, but that works in common cases (adds /php/includes/ directory into open_basedir option).
    Commonly those changes might be done via plesk service plan correction, but when you have too many domain with custom service plans – that might be a pain changing all the domain settings.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search