note 68114 modified in function.ignore-user-abort by danbrown

From: Date: Tue, 13 Jan 2009 05:19:53 +0000
Subject: note 68114 modified in function.ignore-user-abort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-149123@lists.php.net to get a copy of this message
If you want to simulate a crontask you must call this script once and it will keep running forever (during server uptime) in the background while "doing something" every specified seconds (= $interval): <?php ignore_user_abort(1); // run script in background set_time_limit(0); // run script forever $interval=60*15; // do every 15 minutes... do{ // add the script that has to be ran every 15 minutes here // ... sleep($interval); // wait 15 minutes }while(true); ?> --was-- If you want to simulate a crontask you must call this script once and it will keep running forever (during server uptime) in the background while "doing something" every specified seconds (= $interval): <?php ignore_user_abort(); // run script in background set_time_limit(0); // run script forever $interval=60*15; // do every 15 minutes... do{ // add the script that has to be ran every 15 minutes here // ... sleep($interval); // wait 15 minutes }while(true); ?> http://php.net/manual/en/function.ignore-user-abort.php

« previous php.notes (#149123) next »