Reputation: 307
I have a PHP page which gets refreshed every 30 seconds. After every 30 secs, state is checked for some variables and if there is some change in the variables, another task is started. How do i ensure that my PHP continues to work i.e. refresh after every 30 secs even after I have closed my browser or have wind up for the day so that the script continues to work during night.
Please help and thanks in advance!
Upvotes: 2
Views: 59
Reputation: 1034
If the php is triggered by a web browser, the refresh will be triggered by the browser as well, and the program is not running when the browser is not requesting anything.
If you have lower level access to the web server, you can create a cron job or other background task to run some of your code without depending on web browsers connecting to your server. Or perhaps you could start a background shell script from the php, but I'm not sure if that is allowed.
Upvotes: 3