最新消息:

出现file_exists();open_basedir restriction in effect解决方法

php koic_zhzz 272浏览 0评论

在我们使用wordpress建站时出现偶尔会出现在系统菜单templates下出现file_exists(),open_basedir restriction in effect的警告错误提示,当然使用其他网站系统建站时也会出现类似的现象。之所以出现这样现象多是因为不同PHP网站软件对于open_basedir变量兼容性处理的不同。以下是青锋建站给大家分享的解决办法出现file_exists(),open_basedir restriction in effect的警告错误提示的通用解决方法,几乎可以解决所有问题,但需要根据实际情况进行判断。

对于一般CMS出现file_exists(),open_basedir restriction in effect

对于一般CMS出现file_exists(),open_basedir restriction in effect情况的情况可能是没有给予file文件接口访问特定目录的权限。我们需要给予这个站点相应的访问特定目录的权限,我们这里在apache虚拟主机中进行配置,而不是在PHP.INI中进行配置,之所以这么做就是因为在PHP.INI是全局配置,会将权限放大,不安全;而且如果站点较多全写在这里,显得非常多而乱。
<VirtualHost *:80>
ServerAdmin admin@myhost.com
ServerName www.47th.cn
ServerAlias sjzphp.com
DocumentRoot “E:/WWW/sjzphp”
php_admin_value open_basedir “E:/WWW/sjzphp”-这里我们给予网站访问网站所在目录的访问权限。假如我们的程序主目录在网站根目录的其他目录,例如程序目录为program,则我们要这样更改:php_admin_value open_basedir “E:/WWW/program;E:/WWW/sjzphp”;
</VirtualHost>
##VhostEnd

wordpress建站时出现file_exists(),open_basedir restriction in effect的解决方法

对于open_basedir变量是可以在运行时调整的,由于wordpress在内部已经针对open_basedir的判断,因此我们不需要在apache虚拟主机再做增加。而是将这一行注释。实际应该是这样的
<VirtualHost *:80>
ServerAdmin admin@myhost.com
ServerName www.sjzphp.com
ServerAlias sjzphp.com
DocumentRoot “E:/WWW/sjzphp”
#php_admin_value open_basedir “E:/WWW/sjzphp”-注意前面有个‘#’
</VirtualHost>
##VhostEnd

转载请注明:落伍老站长 » 出现file_exists();open_basedir restriction in effect解决方法

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址