今天在git clone公司项目后,
chmod -R 777 bootstrap/
chmod -R 777 storage/
这2个文件设置777权限后,一直报下面的错误:
2017/07/04 09:33:53 [error] 35301#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/ott/bootstrap/autoload.php) is not within the allowed path(s): (/home/wwwroot/ott/public/:/tmp/:/proc/) in /home/wwwroot/ott/public/index.php on line 21
PHP message: PHP Warning: require(/home/wwwroot/ott/bootstrap/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/ott/public/index.php on line 21
PHP message: PHP Fatal error: require(): Failed opening required '/home/wwwroot/ott/public/../bootstrap/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/ott/public/index.php on line 21" while reading response header from upstream, client: 10.170.71.233, server: health.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "health.com"
搞了半天,终于找到解决 方案:
vim fastcgi.conf
将下面这行,注释
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
然后,重启lnmp
lnmp restart