boonjackmedia

Active Member
Apr 28, 2010
35
1
56
Cincinnati, OH USA
There's a ton of info and settings floating around out there about mod_fcgid settings, and tons of frustration's with getting it too work efficiently.

I speak from first hand experience btw... I've invented several new cuss words while dealing with mod_fcgid and fastcgi over the last few years.

Hopefully this pain can be avoided, so let's post some settings and figure out what works best for our setups.

As of now things are working pretty good on our server:
Code:
Server Version: Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 [B]mod_fcgid/2.3.6[/B] mod_bwlimited/1.4 mod_perl/2.0.4 Perl/v5.8.8
Running PHP 5.3.6 on a dedicated box with 8G ram, eAccelerator 0.9.6.1
Here's my mod_fcgid v2.36 settings, in WHM I add these to: Main >> Service Configuration >> Apache Configuration >> Include Editor >> Post VirtualHost Include (so they are retained when apache is rebuilt)

Code:
# mod_fcgid settings v2.36 post_virtualhost_global.conf
<IfModule mod_fcgid.c>
FcgidBusyScanInterval 90
FcgidBusyTimeout 600
FcgidErrorScanInterval 3
FcgidFixPathinfo 1
FcgidIdleScanInterval 70
FcgidIdleTimeout 360
FcgidIOTimeout 1000
FcgidMaxProcesses 1000
FcgidMaxProcessesPerClass 100
FcgidMaxRequestInMem 268435456
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 0
FcgidMinProcessesPerClass 3
FcgidOutputBufferSize 1048576
FcgidPassHeader HTTP_AUTHORIZATION
FcgidProcessLifeTime 3600
FcgidSpawnScore 1
FcgidSpawnScoreUpLimit 10
FcgidTerminationScore 2
FcgidTimeScore 2
FcgidZombieScanInterval 3
</IfModule>
These settings are modified from the defaults a bit for this particular server and any clients sites/apps. Mostly tweaks that needed implemented from various software updates, issues and errors.

Note: FcgidPassHeader HTTP_AUTHORIZATION - This setting might not be needed for your setup.

The mod_fcgid default settings can be found on apache.org.

In /usr/local/apache/conf/php.conf file, I have these settings (I'm also experimenting with adding these to Pre-Main Global in WHM so settings are retained on any updates):

Code:
# Fastcgi configuration for PHP5 - pre_main_global.conf
LoadModule fcgid_module modules/mod_fcgid.so
FcgidMaxRequestsPerProcess 10000
FcgidConnectTimeout 60
FcgidIOTimeout 1000
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml

# PHP configuration pre_main_global.conf
The majority of these settings have been working pretty well for a few weeks now, the last adds were the FcgidSpawn settings. The Apache docs, cPanel forums - staff and user feedback was where the majority of these settings were found. It's an ongoing process though like anything, looking forward to some feedback and ongoing discussions.
 

ikillbill

Well-Known Member
Feb 18, 2008
119
0
66
Hello
errors
[Tue Aug 30 17:10:15 2011] [warn] module fcgid_module is already loaded, skipping

will be shown when we include

LoadModule fcgid_module modules/mod_fcgid.so

on

post_virtualhost_global.conf
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Yes, you shouldn't put the same settings in php.conf into post_virtualhost=_global.conf file.
 

boonjackmedia

Active Member
Apr 28, 2010
35
1
56
Cincinnati, OH USA
Hello
errors
[Tue Aug 30 17:10:15 2011] [warn] module fcgid_module is already loaded, skipping

will be shown when we include

LoadModule fcgid_module modules/mod_fcgid.so

on

post_virtualhost_global.conf
That just means mod_fcgid is listed/loaded somewhere before post_virtual includes, probably in your php.conf file. It's not a critical error.

I load mod_fcgid settings in pre_main_global which is before php.conf and also Worker MPM settings.

I add other Apache modules in post_virtual like mod_deflate, expires, headers, (htaccess stuff) etc.
 

luigidelgado

Well-Known Member
Nov 6, 2010
119
5
68
Mexico
cPanel Access Level
Root Administrator
Twitter
Hi Im having an issue here. I was unable to upload files greaer than 100Kb or so. Datacenter helped me checl the error and the error was:
[Sat Oct 15 10:17:00 2011] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: HTTP request length 132751 (so far) exceeds MaxRequestLen (131072), referer:http://xxx.xxx.com/content/edit/82314/1http://system.quadratin.com.mx/content/edit/82314/1
[Sat Oct 15 10:17:00 2011] [warn] [client xxx.xxx.xxx.xxx] mod_fcgid: HTTP request length 133584 (so far) exceeds MaxRequestLen (131072), referer:http://xxx.xxx.com/content/edit/82314/1

So I changed the settings as recommended here but the issue persists.

I have already restarted Apache, what else am I missing?
 

jpmartinez78

Registered
Oct 11, 2012
2
0
1
cPanel Access Level
Root Administrator
I have a vps and i was planing to create a reseller account for my own websites, 4 of them everything works fine. cpanel accounts, ftp,mysql etc but whe i install the template for wordpress , theres no posibility to generate thumbnails automatically , even if i add manually , obviously i have another hosting provider with cpanel and everything works fine.i suspect there´s a bad configuration or non property . i would like to know what is the best configuration based on wordpress the best performance and run cgi without any problems for cpanel. thanks
 

Duplika

Well-Known Member
Feb 26, 2005
72
7
158
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Twitter
I agree there is ton of different suggested FastCGI settings. Wished cPanel adviced FastCGI over mod_ruid2 and eventually, have a decent default setup.

We are currently using:
Code:
<IfModule mod_fcgid.c>
FcgidMinProcessesPerClass  0
FcgidMaxProcessesPerClass 8
FcgidMaxProcesses 150
FcgidProcessLifeTime 120
FcgidIdleTimeout 60
FcgidIdleScanInterval 30
FcgidMaxRequestLen 1073741824
FcgidIOTimeout 2000
</IfModule>
Other than the Apache configuration adviced, I'd suggest adding a cron to kill old PHP processes and configuring PHP_FCGI_CHILDREN=0 as adviced here.