今天在lnmp 安裝Yii2高級版本的時候优烧,遇到了:
2017/12/15 23:45:10 [error] 22219#0: *9 FastCGI sent in stderr: "PHP message: PHP Warning: require(): open_basedir restriction in effect. File(/data/restfulapi/vendor/autoload.php) is not within the allowed path(s): (/data/restfulapi/api/web/:/tmp/:/proc/) in /data/restfulapi/api/web/index.php on line 5
以上錯誤
終于找到解決辦法:
https://lnmp.org/faq/lnmp-vhost-add-howto.html#user.ini
1.刪除根目錄下的.user.ini
chattr -i? .user.ini
2.LNMP 1.4上如果不想用防跨目錄或者修改.user.ini的防跨目錄的目錄還需要將 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在該行行前添加 # 或刪除改行蝉揍,需要重啟nginx。