在linux服務(wù)器部署站點(diǎn)的時(shí)候PHP報(bào)了這個(gè)錯(cuò)誤
Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/zhuyuyun/thinkphp/start.php) is not within the allowed path(s): (/www/wwwroot/zhuyuyun/public/:/tmp/:/proc/) in /www/wwwroot/zhuangzi/public/index.php on line 20
Warning: require(/www/wwwroot/zhuangzi/thinkphp/start.php): failed to open stream: Operation not permitted in /www/wwwroot/zhuangzi/public/index.php on line 20
Fatal error: require(): Failed opening required '/www/wwwroot/zhuyuyun/public/../thinkphp/start.php' (include_path='.:/www/server/php/56/lib/php') in /www/wwwroot/zhuangzi/public/index.php on line 20
出現(xiàn)問(wèn)題的原因:
查看問(wèn)題描述以及資料,發(fā)現(xiàn)是php open_basedir 配置的問(wèn)題,PHP不能引入其授權(quán)目錄上級(jí)及其以上的文件;
一般情況下是不會(huì)出現(xiàn)這種問(wèn)題的,之所以出現(xiàn)這個(gè)問(wèn)題絕大多數(shù)情況是由于服務(wù)器的原因,為了安全才做了這樣的限制!
fpm/fastcgi user.ini 修改方法
打開(kāi) 項(xiàng)目根目錄下找到 user.ini 文件,搜索 open_basedir,把
open_basedir=/home/wwwroot/www.zhuangzi.com/public/:/tmp/:/proc/
修改為
open_basedir=/home/wwwroot/www.zhuangzi.cn/:/tmp/:/proc/
然后重新啟動(dòng) web 服務(wù)器 即可生效