PHP错误:“有效的open_basedir限制"; [英] PHP error : "open_basedir restriction in effect"
问题描述
我实际上正在尝试将本地WordPress安装安装到我的apache服务器上,但是在访问indexpress.php或Wordpress安装中的任何其他文件时遇到了一些麻烦.的确,访问"www.mysite.com/blog"时我有一个空白页.知道我自己无法修改 apache2.conf 或任何配置文件,所以我想知道是否还有其他解决方案可以解决此问题.
I am actually trying to set up my localhost Wordpress installation to my apache server and I have some trouble to access the index.php or any other file in my Wordpress installation. Indeed I have a blank page while accessing "www.mysite.com/blog". Knowing that I can't modify apache2.conf or any configuration file by myself, I wanted to know if there is any other solution to fix this.
这是我在error.log中获得的信息:
Here is what I obtain in error.log:
[Thu Jul 02 08:57:21 2015] [error] [client 104.6.36.81] PHP Warning: Unknown: open_basedir restriction in effect. File(/var/www/vhosts/mysite.com/httpdocs/blog/index.php) is not within the allowed path(s): (/var/www/vhosts/mysite.com/httpdocs:/tmp) in Unknown on line 0
[Thu Jul 02 08:57:21 2015] [error] [client 104.6.36.81] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[Thu Jul 02 08:57:21 2015] [error] [client 104.6.36.81] PHP Fatal error: Unknown: Failed opening required '/var/www/vhosts/mysite.com/httpdocs/blog/index.php' (include_path='.:') in Unknown on line 0
此外,博客"的所有者是我.
Moreover, the owner of "blog" is me.
任何帮助都将受到欢迎:)
Any help would be welcomed :)
推荐答案
首先,即使在外部访问受限的localhost上,777权限也是不好的.更改文件权限«WordPress Codex 以获得正确和安全的权限方案.
First, 777 permissions are bad, even on localhost where there is limited external access. Changing File Permissions « WordPress Codex for the correct and secure permissions scheme.
第二个 open_basedir限制
实际上是PHP配置错误.您需要在 httpd.conf
中进行更改.您需要找到适用于您的操作系统和Apache的 httpd.conf
的位置.
Second, open_basedir restriction in effect
is a PHP configuration error. You need to make changes in httpd.conf
. You need to find the location of httpd.conf
for your OS and Apache.
请参见 http://php.net/manual/zh-CN/ini.core.php#ini.open-basedir :
在httpd.conf中,可以关闭open_basedir(例如,对于某些虚拟主机)的方式与任何其他配置指令相同"php_admin_value open_basedir没有"
In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none"
这篇关于PHP错误:“有效的open_basedir限制";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!