Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using FastCGI (fcgi). I'm having a problem where more PHP processes are being spawned than what should be, which is eating up my RAM.

I'm using WHM, and so have set the following PHP settings via WHM web interface > Apache Configuration > Include Editor > Pre VirtualHost Include:

<IfModule mod_fcgid.c>
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 500
    FcgidMaxRequestsPerProcess 500

    FcgidMaxProcesses 15
    FcgidMinProcessesPerClass 0
    FcgidMaxProcessesPerClass 8

    FcgidIdleTimeout 30
    FcgidIdleScanInterval 15
    FcgidProcessLifeTime 60
    FcgidIOTimeout 300

    FcgidMaxRequestLen 268435456

(Usually these settings would go in /usr/local/apache/conf/php.conf, but this file is overwritten by WHM when changing various settings, so I had to insert them elsewhere. The above method was recommended in a cPanel forum, and causes the settings to be included in the Apache configuration.)

However, despite FcgidMaxProcesses 15, I've found via top that up to 45 PHP processes are running at any given time during peak usage (and maybe more). For example, here is a screen shot taken last weekend:

screenshot of top output

I really want it limited to 15 processes, maximum. (Even though it looks like I have RAM to spare, it's really 2GB + 1GB burstable. I need to keep it under 2GB as a general rule.)

It's an Apache server, running CentOS 6, Apache 2 (Worker MPM), PHP 5.3.20 (FastCGI/fcgi), and MySQL 5.5.28. 2 GB RAM (3 GB burstable), 24 CPUs.


locked by HopelessN00b Mar 11 at 20:06

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off-topic by HopelessN00b Mar 11 at 20:06

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Ever have any luck on this? –  ylluminate Dec 31 '13 at 10:22
I eventually moved to a server with a lot more RAM, so the PHP processes ceased to be an issue. –  Michael Jan 2 '14 at 16:53

1 Answer 1

I believe the following may be the right approach to addressing this in cPanel:

In particular it has to do with editing /usr/local/cpanel/cgi-sys/php5 to include the following lines:


But be sure that PHP_FCGI_MAX_REQUESTS matches the FcgidMaxRequestsPerProcess from the Apache config.

Further you want to pay attention to the note in the file of copying this over to the appropriate location (/var/cpanel/conf/apache/wrappers/php5) so that it is retained upon apache or php updates.

I have "export PHP_FCGI_CHILDREN=0" as per instructions under "Special PHP considerations" at Also my PHP_FCGI_MAX_REQUESTS=1000. –  Michael Jan 2 '14 at 16:59

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