I've got a PHP process that the user runs within the browser, but takes a reasonably very long time - up to a few minutes. We simply switched to an alternative server, so when we attempt to operate the script now, it consistently occasions out at 4 minutes exactly, delivering to some 500 Internal Server Error page and outputting the next errors within the error log:

Timeout awaiting output from CGI script

Premature finish of script headers: cgi_wrapper

What's interesting would be that the PHP process does appear to accomplish without anyone's knowledge. As we navigate from the 500 Error page and wait a little, the preferred changes in the script get made.

Can there be in whatever way to unhinge this CGI limit which appears to possess been positioned on us? I've find out about FastCGI, but am unsure how you can install this on our server (Apache, centOS, PHP 5.3).

Interesting help!

Most likely the net server occasions out awaiting an answer in the script. Really with four minutes the server appears to become pretty patient. The default for FastCGI connections is thirty seconds.

It might help delivering (and flush()ing) some data towards the client as they delays. This informs both web server and also the browser the request continues to be alive.

For instance, in case your script serves a HTML page in the finish you might send a <!-- please wait... -> every so often. It will not be visible towards the user.

Anyway, any script that can take a lot more than ten seconds to accomplish isn't good design. I would recommend doing that actually work without anyone's knowledge inside a separate process and also have the client poll the conclusion status. Remember that some browsers / proxies may break the request regardless of what you need to do around the server.