PHP配置文件提示Warning:require():open_basedir错误的解决方案
小编:动力软件园 时间:2019-05-20 18:33:12
open_basedir是什么?
open_basedir 的作用是限制php在指定的目录里活动。防止网站被跨站的危险。但是今天在配置帝国cms手机端切换的时候遇到了这个问题。。
但是发现生成是提示
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(../license.php) is not within the allowed path(s):
网站环境 https://www.pw88.com
CDN
apache 5.x
打开apache错误提示。用完关闭。
配置文件php.ini
; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory or ; per-virtualhost web server configuration file. This directive is ; *NOT* affected by whether Safe Mode is turned On or Off. ;open_basedir = .
php.ini默认情况下是关闭的。
可以配置全局,也可以配置到vhost中。找对你的配置文件是http的还是ssl的。很重要了。
如果在Apache的httpd.conf中Directory的相应设置方法:
php_admin_value open_basedir /usr/local/apache/htdocs/
#设置多个目录可以参考如下:
php_admin_value open_basedir /usr/local/apache/htdocs/:/tmp/
:是区分多个目录的标识
重启apache问题解决了
我是先删除该配置成功了。。和网上查询的结果正好相反。不知道错哪里了。但是不配置肯定是没有问题。先解决问题在说。。
排行榜