I'm running php5 behind a nginx proxy, as Fast_CGI, after some usage (Always while being used, not while idle. The Fast_CGI server just shuts down (no longer displays in a 'ps -A'.
In php.ini Log_Errors is set to On and Error_Log is set to /var/log/php.log, however if view php.log only the startup errors are displayed, nothing that would signify php shutting down.
Answer
The best way to find out what the problem is when you don't get any output is to run php under strace. Start up php and get the list of pids from ps. Then run:
# strace -f -o /tmp/php.strace.log -p pid1 -p pid2 -p pid3 ....
Once PHP dies, look in the log to see what happens.
Having said that, in your particular instance, I suspect you have your environment variables wrong. If you have a single php process, this would agree with my hunch. PHP has an option to terminate after a certain number of requests. This is a sensible thing to do to prevent memory leaks and other such problems. There is also an option to specify the number of processes that are running at the same time. If there is only one process, after a number of requests, it will die. The solution is to run more than one processes. The options that I use are:
export PHP_FCGI_CHILDREN=4
export PHP_FCGI_MAX_REQUESTS=1000
If you put these lines in the script you use to start your php server, you should find your PHP website remains running. :)
No comments:
Post a Comment