My website's traffic is starting to pick up, and more and more in my nightly logwatch reports am I seeing multiple Internal Server errors (500). It's due to mod_fcgid.
I've done my research, and luckily have found a (possible) solution on Apache's website: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
If you scroll down a little bit on that page, you'll see a section that perfectly matches my problem:
By default, PHP FastCGI processes exit after handling 500 requests, and they may exit after this module has already connected to the application and sent the next request. When that occurs, an error will be logged and 500 Internal Server Error will be returned to the client. This PHP behavior can be disabled by setting PHP_FCGI_MAX_REQUESTS to 0, but that can be a problem if the PHP application leaks resources. Alternatively, PHP_FCGI_MAX_REQUESTS can be set to a much higher value than the default to reduce the frequency of this problem. FcgidMaxRequestsPerProcess can be set to a value less than or equal to PHP_FCGI_MAX_REQUESTS to resolve the problem.
So I want to take their advice and set
PHP_FCGI_MAX_REQUESTS to a much higher value than the default so that I may reduce the frequency of this problem.
The example they give is this:
# Set desired PHP_FCGI_* environment variables.
# PHP FastCGI processes exit after 500 requests by default.
Where should I add/modify the current wrapper in Virtualmin to apply this? I know that it matters which OS, so I am currently using Ubuntu 10.04 LTS which uses the same directory structure as Debian.
Thank you (and I hope this helps other people with semi-frequent 500 errors).