[原创]配置php+nginx 时遇到的”file not found","access denied"奇怪问题的解决过程
2015-03-23 14:54
1196 查看
在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/没有在其中,将目录加入一切正常。
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/没有在其中,将目录加入一切正常。
相关文章推荐
- centos7 安装nginx和php5.6.25遇到 无法访问php页面 报错file not found 问题解决
- 搭建nginx+php环境时遇到”file not found"的问题
- nginx解析php时报”File not found“问题解决
- 搭建nginx+php环境时遇到”file not found"的问题
- 解决clang"fatal error: 'stdio.h' file not found"问题
- linux下mysql的卸载、安装全过程及遇到"MySQL提示:The server quit without updating PID file问题的解决办法"
- lamp使用php处理上传文件,调用move_uploaded_file函数遇到目录写权限问题及解决过程
- CentOS 7 + Nginx 1.6.2 + PHP 5.4.45 FastCGI错误Primary script unknown网页显示File not found的解决办法
- nginx FastCGI错误Primary script unknown解决办法(访问php提示"File not found.)
- thinkphp nginx下面完美配置解决404 file not found
- JW Player 播放插件 video not found or access denied 问题的解决
- Linux deepin系统下配置nginx+php-fpm+PHPstorm并解决403/404/502/file not found错误
- flash播放器 video not found or access denied 问题的解决
- SPSite site = new SPSite(url); 连接site的时候遇到"FileNotFoundException" 异常的解决方法
- 解决MapReduce编程过程中的 java.io.FileNotFoundException 问题
- 解决PVS6.1中VM启动中的"vDisk file access perission denied"报错问题
- XP硬盘安装Ubuntu双系统遇到的vmlinuz File Not Found问题原因分析及解决
- thinkphp nginx下面完美配置解决404 file not found(让nginx支持PATHINFO路由模式)
- [原创]SQL Server 2008 安装过程中遇到“性能计数器注册表配置单元一致性”检查失败 问题的解决方法
- eclipse创建配置struts项目时遇到的ClassNotFoundException问题解决方案