'mod_fcgid: read data timeout in 40 seconds

we're running centos/cPanel on a good size dedicated server with only one website. we need speed and ability to upload files under 'nobody'. that means suPHP and DSO are out. so the php handler is mod_fcgid. from time to time apache error logs will show mod_fcgid: read data timeout in 40 seconds. we assume it means mod_fcgid is not properly configured when installed using easyapache.

after reading up on g about how to fix we found two tidbits. one deals with MPM. the other, surprisingly, shows how to increase the timeout response (normally increasing timeout response is bad thing as there is something worse inside the server).

should we use MPM event, prefork, and/or worker with mod_fcgid? we currently have prefork configured.

if we do increase the timeout should we use the following settings:

IPCConnectTimeout 20
ProcessLifeTime 120
IdleTimeout 60
IdleScanInterval 30
MaxRequestsPerProcess 499
MaxProcessCount 100

OR

FcgidProcessLifeTime 8200
FcgidIOTimeout 8200
FcgidConnectTimeout 400
FcgidMaxRequestLen 1000000000

And if we do use either of these settings where should they be set: 1) in php.fcgi script, or 2) FastCGI configuration in Apache.



Solution 1:[1]

My tested solution, same issue

target config file :

/usr/local/apache/conf/includes/pre_virtualhost_global.conf

target value :

FcgidIOTimeout

applying changes :

/scripts/rebuildhttpdconf

/etc/init.d/httpd restart

reference : https://wiki.mikejung.biz/Fcgid#FcgidMaxRequestLen

Solution 2:[2]

/etc/apache2/mods-enable/fcgid.conf

*/mods-available/fcgid.conf */sites-enable/site.com.vhost

<IfModule mod_fcgid.c>
   AddHandler fcgid-script .fcgi
   IdleTimeout 300
   BusyTimeout 300
   ProcessLifeTime 7200
   IPCConnectTimeout 300
   IPCCommTimeout 7200
</IfModule>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 zerolab