Well basically I may want to execute a script that may take as much as 1 hours as well.
What I really want to do is Send SMS to my users using a third party API. So its basically like I supply my script with an array of phone numbers and fire the method to send SMS.
However assuming it take 5 seconds to send 1 SMS and I want to send 1000 SMS which is roughly 1 - 2 hours. I can't use set_time_limit()
because I am on shared host.
One way to do this is store numbers in a session and execute each SMS and use javascript to refresh that page until end. This way I need to keep my browser open and the execution will stop if my Internet Connection is disconnected.
So, Is there any better way to do this ?
Hope I am clear enough to explain what I want? I want to execute a large script that may take hours to execute without getting timeout.
A PHP script executed from the command-line or from a shell script, cron job, etc. does not have a timeout.
For CLI-invoked scripts, even if you set the PHP script's timeout dynamically with the set_time_limit()
function, it has no effect.