阿里云主机

万维景盛

万维景盛官网
已解决:指定的 CGI 应用程序由于未返回完整的一组 HTTP 头而产生错误行为force-cgi-redirect

用户在配置阿里云ECS服务器时,遇到报错:指定的 CGI 应用程序由于未返回完整的一组 HTTP 头而产生错误行为,英文报错为:Security Alert!The PHP CGI cannot be accessed directly. 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 万维景盛工程师为您分享解决方法。


服务器错误

502 - Web 服务器在作为网关或代理服务器时收到了无效响应。

您要查找的页面有问题,无法显示。当 Web 服务器(作为网关或代理)与上游内容服务器联系时,收到来自内容服务器的无效响应。

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> ”。


网络上关于此报错的的介绍并不多,万维景盛工程师通过查询中英文资料,一般解决的方法是这样的:

After some research and talking to some php programmer buddies, the solution
seemed to be to add the following to the php.ini :
cgi.force_redirect = 0
cgi.redirect_status_env ="yes";

http://codewalkers.com/archives/phphelp/211.html

也就是在php.ini中将以上两个参数的值分别开启并设为0和yes。

但经万维景盛工程师测试并没有解决问题。更换了php的各种版本,授予php目录各种超级权限都不管用。

经过多番测试,发现使用php manager重新配置php接口,结果问题解决!

估计是通过winiis慧林主机系统设置的cgi模式出现故障,而通过php manager设置的fastcgi的php则解决了问题。

如果亲们要购买或续费阿里云服务器,可以联系万维景盛客服发送邀请注册链接,通过万维景盛注册的VIP阿里云账号,可以新购续费都打折。高配置服务器能节省不少!

< 购物车 > 会员 客服 充值 工单
Top

客服热线

010-80253326

18610695105

客服QQ

请拨总机 010-80253326

咨询售后问题建议 提交工单