Reputation:
I am running a php script as a cron job that might take very long time to finish. It will create a massive xml file and save it.
What should I think of if I implement it?
One thing I do is set max_execution_time for a long time:
ini_set('max_execution_time', 300);
Is there anything else I should do? Increase memory limit? Does it help if put header "keep-alive"?
What can I do to make sure the script will always run until everything neccessary is done?
Upvotes: 3
Views: 1482
Reputation: 6787
You can remove the execution time limit by using the set_time_limit function passing 0
as parameter:
set_time_limit(0);
Adding HTTP headers won't help because as it is a cronjob script, you are not dealing with a browser.
Upvotes: 5