Edit FastCGI Config For cPanel

Author:
phil
Created:
Sunday, February 19th, 2012
Last Updated:
Wednesday, October 02nd, 2019

Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service


I migrated hosts from a shared server package (managed by host) to a VPS package (managed by me) and ran into a http error 0 error on drupal... After about 2 hours of research, I ran across a wonderful blog post out on munkeyonline.co.uk with a handful of tips on how to possibly solve the error.

About halfway down the page is an area titled: "Check FastCGI config" which the author has a single line posted, fixing my issue: "add" MaxRequestLen 15728640 to conf file /etc/httpd/conf.d/fcgid.conf

If you are on a cPanel hosting package, you'll want to add the "FcgidMaxRequestLen" to your:

/usr/local/apache/conf/includes/post_virtualhost_global.conf

You can edit this file directly through SSH or through the WHM page.

Some other common settings worth looking into:

*Additional settings:
FcgidMinProcessesPerClass 0
FcgidMaxProcessesPerClass 3
FcgidMaxProcesses 250
FcgidIdleScanInterval 150
FcgidProcessLifeTime 1800
FcgidIdleTimeout 150
FcgidMaxRequestLen 1073741824

*These settings were copied from http://forums.cpanel.net/f5/zombie-fcgid-processes-don-t-die-261891-p2.h... and have not been modified for any particular use-case.

Additional FCGID information: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidprocesslifetime

Explanation of settings

(From my basic understanding of them)
FcgidIdleScanInterval (default 120)
This setting basically says "how often I should check a php process for IdleTimeout or ProcessLifeTime"

FcgidIdleTimeout (default 300)
This settings will kill off the php process if nothing has happened on it for the specified time. The default is 300 seconds, so if nothing has requested anything to that particular php process after 5 minutes, it will kill the process and free up system resources.

FcgidProcessLifeTime (default 3600)
This setting dictates how long the php process will stick around, period. So if a process keeps getting used here-and-there enough that the IdleTimeout hasn't been able to kill it, after the specified time the php process will be killed off and a brand new one will take it's place. I'm not sure if it kills the process pre-usage or if it waits until the process gets done, but I'm assuming it waits until the php process finishes then kills it off immediately after to allow a new one to take it's place.

Setting this low will potentially cause more disk swapping or CPU usage and setting this high might potentially hold onto precious memory. If you're running a dedicated server, you would want this number higher because you probably have disk swapping enabled in case it eats up too much memory (not recommending disk swapping as a fallback, use it sparingly) or you have a boatloads of extra RAM.

If you're running a VPS, you probably don't have access to disk swapping and you'll need every last ounce of free memory you can get, so you would want to "refresh" the process and free up memory more often. Keep in mind this causes more CPU load on the server because it has to create that the new process, so setting it too low, say several minutes, might be killing it off too quickly. 15 to 20 minutes might be a more reasonable number on a VPS where the default of 3600 (1 hour) makes a lot more sense on a dedicated server with lots of memory.

Post Comment