I have a DV 4.0 from MediaTemple.
I got a "500 internal server error" when I run a php file script that it need to loop a while Over 5000 time.
The code seems to be because when I execute with a 200 time loop, the result is printed.
my "max_input_time", "max_execution_time", "default_socket_timeout" and all others php parameters are not the problem (I guess, all is set at 9000 and memory_limit is -1)
I got this:
[Sat Jan 11 19:25:22 2014] [notice] caught SIGTERM, shutting down
It's because apache restart. My question is: how I can loop more than 5000 times in my script without crashing my systems ;-)
Thank you
Your question is how to loop more than 5000 times.
Looping 5000 or 500000000 times is not the problem. You have an issue somewhere else.
SIGTERM is used to restart Apache (in case where it's setup in init to auto-restart): http://httpd.apache.org/docs/2.2/stopping.html
The log entry you see is supposed to be there because SIGTERM is for that purpose. Maybe, apache doesnt crash but your data has a problem or it runs out of execution time.
It might be a custom PHP module or code. Have a look at apache access/error logs at the time of malfunction. Don't forget to turn error logging on. It may help you to identify what goes wrong. Is it on? ALWAYS TURN ERROR REPORTING ON IF ON DEV MODE!!!
If it's truly crashing, not even serving static content, then that sounds like some sort of a thread/connection exhaustion issue. However, it seems your code has something wrong and you suppress errors.
If you are sure nothing is wrong on your side/code (if it runs on another system), you may need to re-install apache and php and it will solve there was any corrupt file or you misreconfigured it.