Reputation: 2811
I have a php script in codeignitor framework. It works on complex calculation algorithm which needs to keep the script running for at least 4 to 5 days. But it stops after running for few hours. How can I make it keep running until the script finishes?
cron command:
13 21 * * * /usr/bin/php /var/www/project/index.php 'test/mytest'
Upvotes: 0
Views: 467
Reputation: 1220
I think you should use GNU screen for doing this thing. Start a screen, start your PHP script, detach the screen.It'll run until you kill the screen.
Upvotes: 1
Reputation: 11215
You could set your max_execution_time to 432000
But since there is always something else that could stop your script, I would considder making it interruption robust.
Upvotes: 1
Reputation:
set_time_limit(0);
will remove the time-out safety protocol PHP has built-in. Be aware there are more factors, like system breaks and apache/webpanel protocols, that might still abort the script if it runs too long. Some webhosters for example still abort your script, even if you remove the time-out limit.
Good luck testing!
Upvotes: 1