CentOS, Apache & mod_fcgid: IPCCommTimeout not working as expected

Mattias Geniar, Monday, February 28, 2011 - last modified: Sunday, February 19, 2012

If you're running Apache with the mod_fcgid module to let your PHP scripts be handled in a seperate module, you can run into this annoying little bug in the mod_fcgid 2.2.x implementations.

The problem: mod_fcgid: read data timeout in xx seconds

First, check if you have the mod_fcgid module that is causing these problems.

# rpm -qa |grep -i mod_fcgid

Apparently, any 2.2.x branche has this bug.

The problem exists if any VirtualHost does not have the IPCommTimeout value. If there's a VirtualHost where this setting is not defined, it will reset the configuration globally back to the default of 40 seconds, resulting in the following error you Apache's error logs.

[warn] mod_fcgid: read data timeout in 40 seconds
Premature end of script headers: php-cgi, referer: [snip]

And they will throw a 500 Internal Server Error in your access logs.

"GET /path/to/url HTTP/1.1" 500 537

The solution: IPCommTimeout in every virtual host

The solution sucks if you have many (manually controlled) virtual hosts, but you have to define the IPCommTimeout option in every Virtual Host on the server. If one is missing, it will reset the config of that parameter to the default serverwide. So place the following codeblock in every Virtual Host you have.

<IfModule mod_fcgid.c>
IPCCommTimeout          360
IPCConnectTimeout       360

The values above are expressed in seconds.

Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!


frankf Monday, January 21, 2013 at 16:05 - Reply

Thank you soo much, solved the mysteria.

Leave a Reply

Your email address will not be published. Required fields are marked *