码迷,mamicode.com
首页 > 其他好文 > 详细

require(): open_basedir restriction in effect

时间:2019-06-07 10:43:41      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:warning   运行   conf   value   failed   fatal   open   val   fastcgi   

LNMP环境安装Laravel,在nginx.conf将root指向项目的public目录的时候(如:root /home/wwwroot/laravel/public),浏览器运行报500错误,错误信息为:
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/laravel/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/laravel/public/:/tmp/:/proc/:/home/wwwroot/laravel/public/) in /home/wwwroot/laravel/public/index.php on line 24

Warning: require(/home/wwwroot/laravel/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/laravel/public/index.php on line 24

Fatal error: require(): Failed opening required ‘/home/wwwroot/laravel/public/../vendor/autoload.php‘ (include_path=‘.:/usr/local/php/lib/php‘) in /home/wwwroot/laravel/public/index.php on line 24

1、查找php.ini 发现“open_basedir”为注释状态
2、查看nginx下的fastcgi.conf ,发现“fastcgi_param”参数如下
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
这里的$document_root 就是 nginx中定义的root的目录
3、修改nginx下的fastcgi.conf,在后面追加上项目的根目录,如下:
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/wwwroot/laravel/";
4、重启lnmp ,错误消失。

require(): open_basedir restriction in effect

标签:warning   运行   conf   value   failed   fatal   open   val   fastcgi   

原文地址:https://blog.51cto.com/falconfei/2406180

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!