【问题标题】:When I try to openmy webpage I'm getting 'open_basedir restriction in effect' [duplicate]当我尝试打开我的网页时,我得到“open_basedir 限制生效”[重复]
【发布时间】:2013-07-02 14:00:58
【问题描述】:

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

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

【问题讨论】:

  • 这是一个网络服务器配置错误或您的index.php 放置在错误的目录中。
  • 我看不出你的问题是什么。这不是调试站点;问一个更一般的问题并提供更多信息。现在我们所知道的是出现了这个错误。你想执行什么操作?
  • 您是否可以通过 ssh 访问服务器?你有root权限吗?是您的服务器还是您使用托管?
  • @Garan,他试图在网页上进行的操作无关紧要 - 他的 php 脚本在 VIRTUAL_DOCUMENT_ROOT 之外。

标签: php apache


【解决方案1】:

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

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

解决方案是关闭 open_basedir 或将您的“/www”文件夹添加到 open_basedir 包含路径。 这应该在您的 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。联系您的房东,让他们解决问题。

编辑:在 cmets 中链接到。有关更多信息,请参阅此线程:open_basedir restriction in effect. File(/) is not within the allowed path(s):

【讨论】:

  • 您是否阅读了整个答案?我引用'如果您无权访问您的 php.ini...'
  • +1 用于考虑几乎所有可能的选项
猜你喜欢
  • 2012-09-27
  • 2017-04-21
  • 2016-08-26
  • 1970-01-01
  • 2019-10-16
  • 1970-01-01
  • 1970-01-01
  • 2023-03-22
  • 1970-01-01
相关资源
最近更新 更多