xi-jie

配置好PHP环境后,访问页面,页面上只出现了 Access denied字样。

问题分析

打开 /usr/local/php/etc/php.ini 文件,找到 cgi.fix_pathinfo

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP\'s
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=0

这里注释里默认是1,但是用 oneinstack 安装后默认是0。

如果在Nginx里配置了 

fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 

则 cgi.fix_pathinfo=0 必须改为1。

解决

配置修改为 cgi.fix_pathinfo=1,重启 php-fpm 和 Nginx 后解决。

分类:

技术点:

相关文章:

  • 2021-09-01
  • 2021-09-11
  • 2021-11-29
  • 2021-09-11
  • 2021-05-04
  • 2021-09-01
  • 2021-09-11
猜你喜欢
  • 2021-09-01
  • 2021-09-01
  • 2021-09-01
  • 2021-05-09
  • 2021-09-01
  • 2021-10-23
相关资源
相似解决方案