I have PHP5-CGI installed, Apache, and MYSQL installed. Prior to adding these settings, PHP5-CGI would endlessly have >15 processes, each eating up 5 mb of ram. So I added these settings to /etc/apache2/conf.d/php5-fcgid.conf and the PHP5-cgi processes were limited. However, now, everytime I open let's say 20 threads/pages in 4 or 5 minutes, the server stops running properly, things freeze and pages stop loading, until 2 or 3 minutes pass by, then it's lightening bolt fast again.

(1) FYI, dump is a unix backup program. There are far more precise ways to describe your problem that avoid confusion with that utility. (2) We need more information to troubleshoot. Log files, activity statistics, etc. See meta.serverfault.com/questions/3608/… and try to give us a little more detail so we can help you...
–
voretaq7♦Nov 29 '12 at 0:04

1

I meant to say it that way, sorry thought it would be funny. By the way, it just had a bowel movement again.
–
PeteNov 29 '12 at 0:04

woretaq7, should I look at apache logs? Or MYSQL logs, MYSQL logs have been disabled, don't know how to enable them actually.
–
PeteNov 29 '12 at 0:06

Actually, I was thinking core dump. "Server locks up" sounds like a better description but needs more detail (is it only the webserver or does ssh stop? Only on PHP requests or are static images stalled too?)
–
DerfKNov 29 '12 at 0:06

@Pete "yes" (you should look at all relevant logs. see the meta question). We aren't psychic - we can't tell you what's wrong without data. This could very well be a DB bottleneck, so slow query logs from MySQL would be pretty important to have...
–
voretaq7♦Nov 29 '12 at 0:07

1 Answer
1

The first thing I see right off the bat is that your FCGIWrapper looks like the actual php-cgi executable rather than a wrapper script that configures the environment variables PHP expects with values that will work with fcgid. By default PHP quits after 500 requests, but you have fcgid expecting them to last for 1500. You can find examples and an explanation in Apache's documentation but basically you need to set the PHP_FCGI_MAX_REQUESTS environment variable for php-cgi to be greater than the MaxRequestsPerProcess setting fcgid is using.

You can probably skip the wrapper script and just use DefaultInitEnv PHP_FCGI_MAX_REQUESTS 1501 in your Apache config

Also, your configuration is old, all of the directive names have changed but the old ones are usable for now.

Thanks for answering, but I'm really new to all this. What should I change exactly in the code that I displayed? change: DefaultInitEnv PHPRC "/etc/php5/cgi" to DefaultInitEnv PHP_FCGI_MAX_REQUESTS 1501 Is that what you mean?
–
PeteNov 29 '12 at 0:20

You'll need to have two DefaultInitEnv lines.
–
DerfKNov 29 '12 at 0:23

Okay, I will add: DefaultInitEnv PHP_FCGI_MAX_REQUESTS 1501 right below it; should I change 1500 to 500 as well?
–
PeteNov 29 '12 at 0:24

@Pete no, the purpose of this is to keep PHP from killing itself without fcgid knowing about it. With PHP_FCGI_MAX_REQUESTS set to 1501, PHP won't kill itself until the 1501st request, so it will still be there for fcgid to kill after the 1500th request.
–
DerfKNov 29 '12 at 0:30