最近配置开发用的lnmp环境,环境配置完成后,爆500错误,查看nginx错误日志

lnmp 环境require(): open_basedir restriction in effect 错误

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

错误日志显示,访问脚本不在 open_basedir的限定目录里面,配置open_basedir 一般会在php.ini 或 nginx 配置文件里面

首先检测php.ini 我发现并没有配置 open_basedir 

lnmp 环境require(): open_basedir restriction in effect 错误

然后检测nginx配置

lnmp 环境require(): open_basedir restriction in effect 错误

发现 fastcgi.conf 中配置了open_basedir $document_root指向的是网站跟目录 /home/www/yii/web,我的项目用的是Yii2.0 框架需要解析 /home/www/yii 下面的php文件

lnmp 环境require(): open_basedir restriction in effect 错误

由于我配置的是开发环境 ,简单粗暴就把fastcgi.conf 里面open_basedir给注释掉了,线上环境建议 把$document_root 更改为 需要解析的网站目录

 然后就可以愉快的玩耍了

lnmp 环境require(): open_basedir restriction in effect 错误

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2023-03-08
  • 2021-08-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2021-05-15
  • 2022-12-23
  • 2021-05-26
相关资源
相似解决方案