open_basedir 的作用是限制php在指定的目錄里活動。防止網站被跨站的危險。但是今天在配置帝國cms手機端切換的時候遇到了這個問題。。
但是發現生成是提示
1 | Warning: file_exists() [ function . file -exists]: open_basedir restriction in effect. File(.. /license .php) is not within the allowed path(s): |
CDN
apache 5.x
打開apache錯誤提示。用完關閉。
配置文件php.ini
1 2 3 4 5 | ; 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問題解決了
我是先刪除該配置成功了。。和網上查詢的結果正好相反。不知道錯哪里了。但是不配置肯定是沒有問題。先解決問題在說。。