Bug #1527
closedPossible Solution to "Prem. end of script headers" with PHP?
Description
Due to many "Premature end of script headers" while running PHP5.2.5 and lighttpd 1.4.18, I had to switch over to running Apache 2.0.52 to keep my system stable. I found the same errors occuring on that system, but couldn't find anywhere where the code could be causing the issue. I'm running PHP under mod_fcgid in Apache, and checked their site to further tune apache/fcgid to run PHP, and came across the following information:
MaxRequestsPerProcess n (-1) (Added in version 1.11, patch from Robert L Mathews) Adds a MaxRequestsPerProcess parameter that allows mod_fcgid to exit after handling a certain number of requests, similar to the existing ProcessLifeTime option. This solves a problem with PHP in FastCGI mode. By default, PHP stops accepting new FastCGI connections after handling 500 requests; unfortunately, there is a potential race condition during the PHP cleanup code in which PHP can be shutting down but still have the socket open, so mod_fcgid under heavy load can send request number 501 to PHP and have it "accepted", but then PHP appears to simply exit, causing errors. If you are using PHP, you should set it to 500. -1 mean fastcgi process will not exit no matter how many requests it has handled.
I'm wondering whether this is the cause of the problems when running lighttpd with PHP, and whether it would be a simple job to apply a patch to limit the number of requests to 500 per spawned PHP thread?
-- phillip.oldham
Updated by stbuehler about 16 years ago
- Status changed from New to Fixed
- Resolution set to invalid
I didn't see a "Premature end of script headers" message in lighty... that is an apache problem.
Also available in: Atom