Ticket #1527 (closed defect: invalid)

Opened 7 months ago

Last modified 44 hours ago

Possible Solution to "Prem. end of script headers" with PHP?

Reported by: phillip.oldham@… Owned by: jan
Priority: high Milestone: 1.4.20
Component: mod_fastcgi Version: 1.4.18
Severity: major Keywords: PHP, 500, fastcgi
Cc: Blocked By:
Need User Feedback: yes Blocking:

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?

Attachments

Change History

Changed 44 hours ago by stbuehler

  • status changed from new to closed
  • resolution set to invalid

I didn't see a "Premature end of script headers" message in lighty... that is an apache problem.

Add/Change #1527 (Possible Solution to "Prem. end of script headers" with PHP?)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.