php - fastcgi 脚本的处理程序返回了无效的结果代码

标签 php character-encoding soap-client

我对连接到 SOAP 1.2+WSDL 服务的 PHP 应用程序有一个奇怪的问题:

以前的信息:带有 php5-fcgi 模块的 Apache 服务器 2.4。 我正在为 SOAP 服务开发客户端,我可以为该服务做一些请求。

请求需要一些时间才能完成。我需要做一个 set_time_limit(60) 因为如果我没有它,脚本会返回空闲超时错误:

FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: idle timeout (30 sec)

使用 set_time_limit,我得到了另一个不同的错误:

AH00524: Handler for fastcgi-script returned invalid result code 1

当我尝试执行 SOAP 请求时出现这些错误。没有它,页面工作正常。

由于日志中出现此错误,我在导航器上出现了另一个不同的错误。在 IE 上,页面无法加载,Firefox 显示“内容编码错误”页面。

如果我尝试在屏幕上显示 SOAP 连接结果(使用 var_dump),以及如果我尝试执行请求但未将其发送到屏幕,则会出现这些错误。

尝试搜索“内容编码错误”时,我找到了有关压缩的信息。我尝试在 set_time_limit 之前和之后执行“ob_start”,但是,当我尝试执行此操作时,我在日志中收到超时错误(我认为 PHP 不会更改超时),而且页面显示500 内部服务器错误。

有什么问题?我认为可能会出现这些问题的唯一选择是 Apache 和 php5-fcgi 模块之间的一些超时,但我不知道如何修改它以尝试另一个选项。


编辑:

我在同一台机器上有两台服务器,Apache2(2.4.10)+php5-fcgi(5.6.2)(HTTP端口80,HTTPS端口443),Nginx(1.6.2)+php5-fcgi(HTTP端口 8080)。

使用 Apache2 测试的同一页面在 HTTP 和 HTTPS 上不起作用(顶部描述的错误)。然后,我尝试用Nginx(相同的webroot,理论上相同的php5-fcgi配置)进入,然后,正常运行。

谢谢,

最佳答案

大多数情况下,当您使用 fastCGI 时出现空闲超时错误是由于 CGI 请求比空闲超时参数设置的时间长。如果不设置,则默认为 30 秒。

来自mod_fastcgi documentation :

-idle-timeout n (30 seconds) The number of seconds of FastCGI application inactivity allowed before the request is aborted and the event is logged (at the error LogLevel). The inactivity timer applies only as long as a connection is pending with the FastCGI application. If a request is queued to an application, but the application doesn't respond (by writing and flushing) within this period, the request will be aborted. If communication is complete with the application but incomplete with the client (the response is buffered), the timeout does not apply.

在日志文件中你可以看到这样的东西:

[fastcgi:error] FastCGI: comm with server "/var/www/bin/php-fastcgi" aborted: idle timeout (30 sec), referer: http://example.org/script.php

在网络浏览器中,您会收到“内容编码错误”消息。

为避免此错误,可以增加 fastCGI 配置中的空闲超时。

FastCgiConfig -idle-timeout 900

因此,通过增加空闲超时,您不再需要使用 set_time_limit。

关于php - fastcgi 脚本的处理程序返回了无效的结果代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28751020/

相关文章:

php - 我可以在 Azure 逻辑应用程序中进行 SOAP API 调用吗

java - Soap 错误 : XML validation error on request: cvc-complex-type. 4:属性 'Id' 必须出现在元素上

java - 如何避免在 CXF 库 (SOAP) 中使用 CONNECT http 方法

php - Eloquent ORM "standalone"DB::raw 失败

PHP Cron 作业 Windows 和 Linux

php - 尝试在 php 中使用 count(*) 时收到 undefined variable

php - 在 URL 中发送阿拉伯字符

php - 如何使用连接表将记录添加到数据库 - codeigniter

python - bottle_mysql 编码失败

visual-studio-2008 - 如何在Visual Studio 2008中将文本编码更改为iso-8859-1