[Solved] Intermittant apache failures: Connection reset by peer: mod_fcgid

(OP notes: the mention of Sunday in the post below is a red herring, actually the failures were intermittent).

Hi All,

Every Sunday I get a problem with where my php sites a server error rather than my website.

In my virtual host apache logs I get the following:

[Sun May 10 12:13:01 2015] [warn] [client xxx.xxx.xxx.xxx (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun May 10 12:13:01 2015] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: index.php

If I restart apache the problem goes away.

I am using Virtualmin version 4.16.gpl.
Virtualmin is running on Ubuntu precise.

Does anybody have any ideas about what is causing this and how to fix it.

If I can’t fix it directly but someone can tell me which cron is causing the issue, then I would be happy to arrange another cronjob to restart apache every Sunday too.




Hmm, that’s an unusual problem!

Does it seem to happen the same time every Sunday?

Or does the time seem somewhat random?


Hi Eric,

Thank you for responding to me.

I had a scan through the logs from the various virtual servers that I have, and I noticed that every Sunday at 4:35 there is a weekly log rotation occurring. I guess this might be the source of the apache issue so I have scheduled a cron job to restart apache @ 5:00am on Sundays.

I have really no clue what is causing this particular issue, but I hope that change will put an end to the problem.

For anyone else who happens upon this post, try adding the following to your root crontab.

1 5 * * 6 /usr/sbin/service apache2 restart

I will follow up again if this doesn’t solve it, or if I find the route cause at some point.



Hi All,

I finally found the cause of the intermittent failures I was having. The Sunday timing was a red herring, actually this problem was popping up all over different virtual servers that I have at varying times. I was just noticing it more on Sundays.

It turns out I was using two apache modules headers and expires which were not part of the default installation. When I disabled these then my issues went away.

a2dismod expires

a2dismod headers

service apache2 restart

I hope that helps someone if they end up with similar issues.