问题
I have a strange question with PHP app connecting to a SOAP 1.2+WSDL service:
Previous information: Apache server 2.4 with php5-fcgi module. I'm working on a client for a SOAP service, and I can do some request for the service.
The request took some time to complete. I've needed to do a set_time_limit(60) because if I doesn't have it, the script return idle timeout error:
FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: idle timeout (30 sec)
With set_time_limit, i got another different error:
AH00524: Handler for fastcgi-script returned invalid result code 1
These error appears when I try to do the SOAP request. Without it, the page works OK.
With this error on log, I have another different error on navigator. On IE, the page doesn't load, Firefox show "Content Encoding Error" page.
These error appears if I try to show on screen the SOAP connection result (with a var_dump), and, also, if I try to do the request but doesn't send it to screen.
Trying to search for the "Content Encoding Error", I've find something about compression. I've tried to do "ob_start" before and after set_time_limit, but, when I try to do it, I get an timeout error at log (I think PHP doesn't make the timeout change), and, also, the page shows an 500 internal server error.
What's the problem? The only option I think can be getting these problem are some timeout between Apache and php5-fcgi module, but I doesn't know how to modify this for trying another option.
EDIT:
I have two servers on the same machine, Apache2 (2.4.10) + php5-fcgi (5.6.2) (HTTP port 80, HTTPS port 443), and Nginx (1.6.2) + php5-fcgi (HTTP port 8080).
The same page, tested with Apache2 does not work (Error described at top), on HTTP and HTTPS. Then, I try to enter with Nginx (Same webroot, theoretically same php5-fcgi config), and then, running properly.
Thanks,
回答1:
Most of the times idle timeout error when you use fastCGI is caused by a CGI request longer than the time set up with idle-timeout parameter. If not set up, the default is 30 sec.
From the 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.
In log files you can see something like this:
[fastcgi:error] FastCGI: comm with server "/var/www/bin/php-fastcgi" aborted: idle timeout (30 sec), referer: http://example.org/script.php
And in a web browser yoy get the "Content Encoding Error" message.
To avoid this error it is possible to increase the idle timeout in fastCGI configuration.
FastCgiConfig -idle-timeout 900
So, by increasing idle timeout you don't need to use set_time_limit anymore.
来源:https://stackoverflow.com/questions/28751020/handler-for-fastcgi-script-returned-invalid-result-code