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

今天在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。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • 一、MemCache簡介 session MemCache是一個自由、源碼開放、高性能、分布式的分布式內存對象緩存...
    李偉銘MIng閱讀 3,852評論 2 13
  • 更改ip和dnsVi /etc/sysconfig/network-scripts/ifcfg-eth0vi /...
    Xwei_閱讀 1,846評論 0 3
  • 系統環境 所需軟件官方下載地址: 一、 安裝開發包環境: 二、 關閉iptables和Selinux(生產...
    莫名其妙的一生閱讀 1,322評論 0 4
  • 一、配置防火墻,開啟80端口、3306端口 CentOS 7.0默認使用的是firewall作為防火墻,這里改為i...
    ArleyDu閱讀 2,110評論 0 0
  • 其實人最難的就是堅持,就像每天給自己寫個小短篇,不管有多少都是自己堅持的一部分。程序猿是辛苦的,即使做了一天,也許...
    Joseph小白閱讀 305評論 0 1