I have a PHP script which running some crawling job, and which probably require 5 minutes above to complete.
My question as below:
If I try to execute the script via browser request, probably will experience a request timeout after 30 seconds, but is it the script still running on server until completion?
If I execute the script via cron job, how do I trace the running status? How do I know if the script still running or already been kill by server?
Is it possible to increase the maximum execution time via PHP code without touching the php.ini file?
Appreciate for the reply.
If I try to execute the script via browser request, probably will experience a request timeout after 30 seconds, but is it the script still running on server until completion?
your script also stop processing on server.
If I execute the script via cron job, how do I trace the running status? How do I know if the script still running or already been kill by server?
You can track it by putting log in file at beginning of your script and at the end of your script.
Is it possible to increase the maximum execution time via PHP code without touching the php.ini file?
You can increase the maximum execution time via PHP code by
ini_set('max_execution_time',300);
but it will only work if your HTTP_CONNECTION variable is set to keep-alive on server.