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阅读 9,270评论 2 13
  • 更改ip和dnsVi /etc/sysconfig/network-scripts/ifcfg-eth0vi /...
    Xwei_阅读 5,854评论 0 3
  • 系统环境 所需软件官方下载地址: 一、 安装开发包环境: 二、 关闭iptables和Selinux(生产...
    莫名其妙的一生阅读 5,121评论 0 4
  • 一、配置防火墙,开启80端口、3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为i...
    ArleyDu阅读 6,321评论 0 0
  • 其实人最难的就是坚持,就像每天给自己写个小短篇,不管有多少都是自己坚持的一部分。程序猿是辛苦的,即使做了一天,也许...
    Joseph小白阅读 2,224评论 0 1