我按照所有说明在Centos Linux VPS上设置我的symfony项目(版本1.4)。当我打开这个文件时htp://myserver/backend.php我收到这个错误:
Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/var/www/html/myproject/web/../config/ProjectConfiguration.class.php) is not within the allowed path(s): (.) in /var/www/html/myproject/web/backend.php on line 4
Warning: require_once(/var/www/html/myproject/web/../config/ProjectConfiguration.class.php) [function.require-once]: failed to open stream: Operation not permitted in /var/www/html/myproject/web/backend.php on line 4
Fatal error: require_once() [function.require]: Failed opening required '/var/www/html/myproject/web/../config/ProjectConfiguration.class.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/myproject/web/backend.php on line 4
在php.ini和httpd.conf
中禁用安全模式第4行的backend.php文件有:
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
此:
echo dirname(__FILE__).'/../config/ProjectConfiguration.class.php';
返回
/var/www/html/myproject/web/../config/ProjectConfiguration.class.php
那里有什么问题? 我无法弄清楚为什么不起作用。
答案 0 :(得分:0)
我在httpd.conf中添加了这些行:
<Directory /var/www/html>
php_admin_value open_basedir none
</Directory>
我不知道这个问题是否仅在centos中发生但是safe_mode禁用是不够的。 open_basedir应设置为NONE。