mod_fcgid: error reading data from FastCGI server

I have an Unbunu 14.04 server with Virtualmin/Webmin on. I chose this because we want a newer version of PHP and PHP on Centos 6 is too old for us.

Problem is we have an intermittent issue that I have no idea about. Error messages are not very explanatory. And its intermittent too. The site works OK most of the time, but occasionally it will just spin and spin and then show an Internal Server Error.

Here are the errors, specifically “mod_fcgid: error reading data from FastCGI server”

[Thu Sep 17 14:27:11.450306 2015] [fcgid:warn] [pid 1337] (104)Connection reset by peer: [client xx.xx.xx.xx:60256] mod_fcgid: error reading data from FastCGI server, referer:
[Thu Sep 17 14:27:11.450427 2015] [core:error] [pid 1337] [client xx.xx.xx.xx:60256] End of script output before headers: index.php, referer:

Does anyone know why this would occur and how to fix?

PHP memory is 256Mb and FCGI timeout is changed to unlimited.



Would it be possible to temporarily change the PHP Execution Mode to CGI?

Using CGI tends to generate better error messages.

You can do that in Server Configuration -> Website Options.


Thanks, but I get this when I switch to CGI so switched back.

Not Found
The requested URL /cgi-bin/php5.cgi/index.php was not found on this server.