找回密码
 新建账号

IIS The PHP CGI cannot be accessed directly.

[复制链接]
php 发表于 2017/10/14 15:27 | 显示全部楼层 |阅读模式
IIS The PHP CGI cannot be accessed directly.
HTTP 错误 502.2 - Bad Gateway
指定的 CGI 应用程序由于未返回完整的一组 HTTP 头而产生错误行为。它实际返回的头是“<b>Security Alert!</b> The PHP CGI cannot be accessed directly. <p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.</p> <p>For more information as to <i>why</i> this behaviour exists, see the <a href="http://php.net/security.cgi-bin">manual page for CGI security</a>.</p> <p>For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit <a href="http://php.net/install.windows">the manual page</a>.</p> ”。解决方法:打开生效的PHP配置文件php.ini,搜索cgi.force_redirect,将值修改为0,即cgi.force_redirect = 0 即可。
cgi.force_redirect is necessary to provide security running PHP as a CGI under most web servers. Left undefined, PHP turns this on by default. You can turn it off at your own risk. Windows Users: When using IIS this option must be turned off. For OmniHTTPD or Xitami the same applies.
该配置项默认值为1,在IIS中运行PHP必须将cgi.force_redirect配置为0才能正常运行。

手机版|轻松E站

GMT+8, 2024/10/7 16:24

快速回复 返回顶部 返回列表