Re: php-cgi eat up the memory
Posted: Fri Mar 21, 2014 2:28 am
I think I solved the problem.
I dig many articles and there are some parameter need to add if someone face same problem
Acrossing to the document from apache, http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
PHP_FCGI_CHILDREN should set to 0 due to any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.)
That's why so many php-cgi process was created but not close properly.
The file location is in /home/YOUR_USER/web/YOUR_WEB/cgi-bin/fcgi-starter
Second, edit /etc/httpd/conf.d/fcgid.conf
these parameter should be added after "LoadModule fcgid_module modules/mod_fcgid.so"
REMEMBER BACKUP THE FILE BEFORE YOU EDIT
I dig many articles and there are some parameter need to add if someone face same problem
Acrossing to the document from apache, http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
PHP_FCGI_CHILDREN should set to 0 due to any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.)
That's why so many php-cgi process was created but not close properly.
The file location is in /home/YOUR_USER/web/YOUR_WEB/cgi-bin/fcgi-starter
Second, edit /etc/httpd/conf.d/fcgid.conf
these parameter should be added after "LoadModule fcgid_module modules/mod_fcgid.so"
Code: Select all
FcgidMinProcessesPerClass 0 #no process will be created if the user not active
FcgidMaxProcessesPerClass 16
FcgidMaxProcesses 150
FcgidIdleTimeout 60 #if the process idle 60s will be killed
FcgidProcessLifeTime 120
FcgidIdleScanInterval 30
# Change the rate at which new FastCGI processes are spawned under load. Higher=faster
FcgidSpawnScoreUpLimit 10
# Higher number = spawning more FastCGI processes decreases the spawn rate (controls runaway
FcgidSpawnScore 1
# Higher number = terminating FastCGI processes decreases the spawn rate (controls runaway)
FcgidTerminationScore 2
# Increase the FastCGI max request length for large file uploads (needed for some sites)
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 100000
FcgidIOTimeout 1800