错误详情(php.ini的bug调试打开,默认是关闭的)
Laravel运行环境 Linux Nginx
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/ssmanager/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/ssmanager/public/:/tmp/:/proc/) in /home/wwwroot/ssmanager/public/index.php on line 24
Warning: require(/home/wwwroot/ssmanager/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/ssmanager/public/index.php on line 24
Fatal error: require(): Failed opening required '/home/wwwroot/ssmanager/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/ssmanager/public/index.php on line 24
解决方法
1、找到Nginx中的fastcgi.conf配置文件,一般位于fastcgi.conf
文件中
/usr/local/nginx/conf/fastcgi.conf
2、打开文件找到如下部分
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
将其$document_root
变量修改为项目目录(最好注释掉这行),例如我现在的项目是test
(Laravel项目),只需将$document_root
修改为test
所在的目录。
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/home/www/test/:/tmp/:/proc/";
3、重启Nginx服务器
nginx -s reload