yii2-advanced版lnmp環境下500問題
阿新 • • 發佈:2018-12-08
開啟php.ini的錯誤顯示:display_error=on
,檢視到如下錯誤
Warning: require(): open_basedir restriction in effect. File(/opt/yii-app/vendor/autoload.php) is not within the allowed path(s): (/opt/yii-app/api/web/:/tmp/:/proc/) in /opt/yii-app/api/web/index.php on line 5
Warning: require(/opt/yii-app/vendor/autoload.php): failed to open stream: Operation not permitted in /opt/yii-app/api/web/index.php on line 5
Fatal error: require(): Failed opening required '/opt/yii-app/api/web/../../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /opt/yii-app/api/web/index.php on line 5
將/usr/local/nginx/conf/fastcgi.cong
下面這段內容註釋,否則require無法引入上級目錄的檔案
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
參考:https://blog.csdn.net/weixin_41490929/article/details/79177916