Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've a Plesk 9.5.4 server on Debian with PHP 5.2.6-1+lenny13, which keeps its php5-cgi process continuously active. I edited the /etc/apache2/conf.d/fcgid.conf and changed the values (and checked if the config was loaded anyway, which was true).

IdleTimeout 500
ProcessLifeTime 360

But still the process keeps alive for over an hour, and there is no activity for longer than half a hour.

Anyone knows what the problem can be?

share|improve this question

2 Answers 2

CGI process are kept "alive" so they can handle requests immediately. They do not terminate after a single request, but are often configured to handle 500-5000 requests until they get replaced with a new one.

The relevant config options are

PHP_FCGI_CHILDREN=60
PHP_FCGI_MAX_REQUESTS=5000

CGI process management

The web server does not care care itself about handling 50+ PHP-CGI instances that may handle requests, but leaves this job to the CGI server. The CGI server itself keeps a pool of PHP-CGI instances running. It also kills them when they are not needed anymore and starts them when required.

CGI server configuration

IdleTimeout

tells the CGI process manager how long to wait for the CGI process to return a response.

Example:

The web server gets a HTTP request, sends that to the CGI server, CGI server relays that to the PHP-CGI process. Now the PHP-CGI process computes and computes and takes 1 minute to finish. Since the timeout is 120, everything is fine.

Now another request comes in, and the computation is harder, and the PHP-CGI process takes 10 minutes to finish. After 2 minutes, the CGI server reaches the CGI process' idle timeout and decides not to wait any longer. It returns an error to the HTTP server: "no data retrieved, idle timeout".

ProcessLifetime

is the number of seconds that a CGI process may be kept running. After that it's replaced with a new one.

share|improve this answer
    
Used this in the config : IdleTimeout 500 ProcessLifeTime 360, so normaly they would be killed after 360 seconds –  Martijn Bakker Aug 19 '11 at 13:10
    
Yes, this is clear, but the process isn't be replaced, but the process remains for days and longer. –  Martijn Bakker Aug 19 '11 at 14:22
    
@Martijn it's probably because of the other settings I mentioned which keep a minimum number of processes around regardless of timeouts. –  EightBitTony Aug 19 '11 at 14:47

mod_fastcgi

Check your setting for

-minProcesses n (5) The minimum total number of dynamic FastCGI application instances allowed to run at any one time without being killed off by the process manager (due to lack of demand).

It defaults to 5.

mod_fcgid

Check your setting for

FcgidMinProcessesPerClass

This directive sets the minimum number of processes that will be retained in a process class after finishing requests.

This setting will apply to all applications spawned for this server or virtual host. Use FcgidCmdOptions to apply this setting to a single application.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.