I've got a PHP class, once known as, sets time limit to a minute. The only real special factor relating to this class is it uses curl_multi_professional().
set_time_limit(60) ini_set('max_execution_time', 60)
The issue is that under Apache's /server-status page, this site and the other one which uses single threaded curl run past their max_execution_some time and achieve as much as 200 seconds, sometimes!
What am I missing? It is possible to method to setup Apache to terminate scripts (as well as connections) running for over say 90 seconds? Thanks.
From the manual:
set_time_limit()function and also the configuration directive
max_execution_timeonly modify the execution duration of the script itself. Whenever allocated to activity that occurs outdoors the execution from the script for example system calls using
system(), stream procedures, database queries, etc. isn't incorporated when identifying the utmost time the script continues to be running.
Because curl demands come under this category, time spent awaiting a request to accomplish won't be counted. You need to set the curl setting
CURLOPT_TIMEOUT to some lower value, or monitor time put in performing your script yourself.
Aha! Whenever you set that configuration, the ticker starts over itself, example:
sleep(10) set_time_limit(20) sleep(10) set_time_limit(5) sleep(10) // dies after 5 seconds
Total running time is ~30s.
In relation to
curl_professional_multi, you are able to set the CURL timeout option rather than the PHP one. This is dependent on who'd rather die inside your opinion - the curl connection, or even the full request.