[原创]配置php+nginx 时遇到的”file not found","access denied"奇怪问题的解决过程

在centos 7中按照我的随笔转载文章"[转载]CentOS 下安装LEMP服务(Nginx、MariaDB/MySQL和PHP)"安装好后,结果无法显示phpinfo()信息,出现过“file not found","No iput file is specifed","access denied"等各种奇怪错误,百度了各种文章都说是/etc/nginx/conf.d/default.conf配置里的路径root配置不正确造成的,但检查了几千遍也没发现有问题。经过查看/var/logs/nginx/error.log日志发现了问题所在:

2015/03/23 20:54:57 [error] 3246#0: *4 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/usr/share/nginx/html/test.php) is not within the allowed path(s): (.:/tmp/) in Unknown on line 0
PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Unable to open primary script: /usr/share/nginx/html/test.php (Permission denied)" while reading response header from upstream, client: 192.168.1.101, server: localhost, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.107"
2015/03/23 20:54:57 [error] 3246#0: *4 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/usr/share/nginx/html/test.php) is not within the allowed path(s): (.:/tmp/) in Unknown on line 0

很显然问题在php.ini的open_basedir限制了能够读取的文件夹,只设置了open_basedir=.:/tmp/,而/usr/share/nginx/html/没有在其中,将目录加入一切正常。

转载于:https://www.cnblogs.com/zzyyxxjc/p/4359812.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值