Connection reset by peer: mod_fcgid

I recently moved my websites to a new dedicated server with Virtualmin. Although, I’m getting some apache errors, here they are:

[Mon Feb 18 12:07:38 2013] [warn] [client IPHERE] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Mon Feb 18 12:07:38 2013] [warn] [client IPHERE] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

This happens every hour when a cURL is run by a cron job. With a fast search, it seems that I have to add a FcgidBusyTimeout 3600 in my /etc/httpd/conf.d/fcgid.conf, but I did it and then I started to get “mod_fcgid: stderr: PHP Notice: Undefined variable:” errors like crazy. Am I adding it in the wrong place? Can someone please guide me to the write place (full path)?

I’ve also tried to change the “Maximum fcgid execution time” to “Time in seconds: 3600” in the Virtualmin Configuration Panel, but it stays with the same errors of connection resets.

Thank you guys in advance.


Hmm, it almost sounds like there may be some sort of issue with the script that curl is calling.

However, one thing you could try that may make identifying the problem simpler is to go into Server Configuration -> Website Options, and to change the PHP Execution Mode to “CGI”.

After doing that, do you get a different error message? If so, what is it?


Thank you for the reply. I don’t think that this is an issue with the script, it was working fine with the other server. I’ve changed the Execution Mode to CGI, and now I get this:

[Mon Feb 18 17:01:01 2013] [warn] [client IPHERE] Timeout waiting for output from CGI script /home/mywebsite/cgi-bin/php5.cgi
[Mon Feb 18 17:01:01 2013] [error] [client IPHERE] Script timed out before returning headers: php5.cgi

So, both fcgid and cgi gives me problems with timeouts? What should I do?

Thank you for the help.

It’s a long running process it does work eventually but I do have a couple things set up that take longer than a standard setup. TBH the benefits are worth the 10 or so minute wait time. Sets up DKIM/DNSSEC/Script Installer the last one in only some cases. But vm takes a while to set up an account under these conditions. That’s all well and good WHMCS connects to vm via curl. It times out after 60 seconds. I’ve got Timeout set manually on my whmcs vhost to 600 which is 10 minutes. I have had both php_max_execution_time and the fcgid time set properly to 10 minutes tried running cgi which is my main php execution method for my servers. As I wanted certain configuration. These more liberal settings don’t apply to new virtualservers. Have CSF set to accept connections entirely from my main domain and my cluster’s ip addresses on all relevant ports. Experiencing the same errors. Even my other normal vhosts need to have 90 second timeout which they are configured relevantly. It seems all these are ignored and instead adhere to a 60 second timeout.