网站首页 文章专栏

require(): open_basedir restriction in effect 解决

Mr.hao
Mr.hao HSBLOG 2018-05-28 18:16:40

环境:Centos7.4,部署yii2,Warning: require(): open_basedir restriction in effect. ,

failed to open stream: Operation not permitted

QQ截图20180528181248c.png

open_basedir 将 PHP 所能打开的文件限制在指定的目录树,包括文件本身

检测/usr/local/php/etc/php.ini 并没有配置 open_basedir

QQ截图20180528181147b.png

#/usr/local/nginx 目录下
grep -rn open_basedir ./

QQ截图20180528180808a.png

vim /usr/local/nginx/conf/fastcgi.conf

fastcgi_param PHP_ADMIN_VALUE  "open_basedir=$document_root/:/tmp/:/proc/";

# 修改成:

fastcgi_param PHP_ADMIN_VALUE  "open_basedir=NULL";  

# 重启php-fpm
/etc/init.d/php-fpm restart
# 重启一下nginx
service nginx reload

#(建议 把$document_root 更改为 需要解析的网站目录)


沟通交流
  • 消灭零回复