我需要为Plesk 10上的虚拟子域名提供包含path。我已经将PHP PEARpath编辑到/etc/php.ini中,因为我很高兴它可以在全球范围内使用:
include_path = ".:/usr/share/pear/"
这是有效的,因为当脚本尝试包含它们时,PHP能够看到那个目录中的文件,但是我得到了可怕的openbasedir错误:
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/)
我说的是,子域或主域可以有一个vhost.conf文件,我可以改变openbasedir允许的path? 我试过寻找解决办法,但恐怕我不能看到一个:)
啊发现了!
1)为子域创buildvhost.conf:/var/www/vhosts/xxxx.com/subdomains/test/conf/vhost.conf
2)添加以下内容:
<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)configurationplesk来识别新的vhost.conf
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain test.xxxx.com
4)重新启动Apache
service httpd restart