我按照所有说明在 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
那里有什么问题?我无法弄清楚为什么不起作用。