mod_fcgid: read data timeout in 31 seconds

January 7, 2013 in Linux

I have just noticed in one of the servers managed by me an interesting error.

[error] [client 123.123.123.123] Premature end of script headers: file.php, referer:

At the first look peoples can say that there is a php error but after a closer look i have noticed a warning that explained everything.

[warn] [client 123.123.123.123] mod_fcgid: read data timeout in 31 seconds, referer:


It seems that *default* max_execution_time on php is 30 seconds in php.ini
max_execution_time = 30
Here is a quick fix for this issue :

On webmin/virtualmin :
Login to webmin
Choose domain that has the problem
Server Configuration
Website Options
Increase maximum PHP script run time
Save

OR
edit
/home/USER/etc/php.ini
/home/USER/etc/php5/php.ini
modify max_execution_time to a higher value (30 = 30 seconds default) like 60
or disable it with

max_execution_time = 0

save and reload apache

On servers without webmin/virtualmin
modify max_execution_time in /etc/php5/apache2/php.ini with desired value or set 0 for unlimited.
reload apache

UPDATE :

Since this error is generated by mod_fcgid add this setting into your virtualhost or to make it global in fcgid.conf considering that you want to raise timeout value from 30 seconds to 60.

IPCCommTimeout 60