当我尝试打开我的网页时,我的'open_basedir限制有效'

时间:2013-07-02 14:00:59

标签: php apache

我从主机服务器收到此错误:

Warning: Unknown: open_basedir restriction in effect. File(/www/zxq.net/k/u/p/kuptoje/htdocs/index.php) is not within the allowed path(s): (VIRTUAL_DOCUMENT_ROOT) in Unknown on line 0

Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0

Fatal error: Unknown: Failed opening required '/www/zxq.net/k/u/p/kuptoje/htdocs/index.php' (include_path='.:/usr/lib/php') in Unknown on line 0

1 个答案:

答案 0 :(得分:1)

某些主机设置了open_basedir限制。这意味着只允许来自set include_path内部的文件。

您的include_path设置为'/usr/lib/php',但您尝试要求'/www/zxq...'中的文件,而该文件不在允许的include_path中。

解决方案是关闭open_basedir或将'/ www'文件夹添加到open_basedir include_path。 这应该在你的php.ini文件中完成(通常位于/etc/php.ini)你只需将/ www目录添加到php.ini文件中。例如include_path='.:/usr/lib/php:/www/zxq.net'

如果您无法访问php.ini文件,可以尝试在php中设置它:http://php.net/manual/en/function.set-include-path.php如果不起作用,则不允许您编辑include_path。联系您的主机,让他们解决问题。

编辑:与评论中的链接相关联。有关详细信息,请参阅此主题:open_basedir restriction in effect. File(/) is not within the allowed path(s):