Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to allow an include path for a vhost subdomain on Plesk 10. I've edited the PHP PEAR path into /etc/php.ini as I'm happy for it to be globally available:

include_path = ".:/usr/share/pear/"

This works insofar as PHP is able to see the files in that directory when a script tries to include them, but I'm getting the dreaded openbasedir error:

Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/usr/share/pear/xxxx.php) is not within the allowed path(s): (/var/www/vhosts/xxxx.com/subdomains/test/httpdocs/:/tmp/) 

Am I right in saying that the subdomain or main domain can have a vhost.conf file in which I can alter the openbasedir allowed paths? I've tried searching out solutions but I'm afraid I can't quite see one yet :)

share|improve this question

1 Answer 1

Ah found it!

1) create vhost.conf for the subdomain: /var/www/vhosts/xxxx.com/subdomains/test/conf/vhost.conf

2) add the following:

   <Directory /var/www/vhosts/xxxx.com/subdomains/test/httpdocs>
      <IfModule sapi_apache2.c>
        php_admin_value open_basedir "/var/www/vhosts/xxxx.com/subdomains/test/httpdocs:/tmp:/usr/share/pear"
      </IfModule>
      <IfModule mod_php5.c>
        php_admin_value open_basedir "/var/www/vhosts/xxxx.com/subdomains/test/httpdocs:/tmp:/usr/share/pear"
      </IfModule>
    </Directory>

3) Configure plesk to recognise new vhost.conf

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain test.xxxx.com

4) Restart apache

service httpd restart
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.