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
mod_fcgid-2.2-11.el5

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
</IfModule>

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 and podcaster. Currently working on DNS Spy. Follow me on Twitter as @mattiasgeniar.

I respect your privacy and you won't get spam. Ever.
Just a weekly newsletter about Linux and open source.

SysCast podcast

In the SysCast podcast I talk about Linux & open source projects, interview sysadmins or developers and discuss web-related technologies. A show by and for geeks!

cron.weekly newsletter

A weekly newsletter - delivered every Sunday - for Linux sysadmins and open source users. It helps keeps you informed about open source projects, Linux guides & tutorials and the latest news.

Share this post

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

Comments

frankf Monday, January 21, 2013 at 16:05 (permalink)

Thank you soo much, solved the mysteria.

Reply


Leave a Reply

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