Ignore_user_abort (1) and set_time_limit (0) then set an infinite loop. how do I terminate it? This post was last edited by zhoumengkang from 2013-08-0917: 24: 21 Today. the example in ingore_user_abort () in the manual is indeed ignore_user_abort (1) and set_time_limit (0) then I set an infinite loop. how can I terminate it?
This post was last edited by zhoumengkang at 17:24:21
The example in ingore_user_abort () in the manual can be executed infinitely. But what if I terminate this process? The example in the manual is not described. If the server is not restarted. How can I find the process and terminate it?
ignore_user_abort(0); // run script in background
set_time_limit(0); // run script forever
$interval=2; // do every 15 minutes...
do{
$data = '1
';
file_put_contents('./test.html',$data,FILE_APPEND);
sleep($interval); // wait 15 minutes
}while(true);
Share:
------ Solution --------------------
In cli mode
$ Pid = getmypid ();
Ignore_user_abort (0 );
Set_time_limit (0 );
$ Integer = 200;
Do {
Echo "$ pid"; // Obtain the pid
Sleep ($ interval );
} While (true );
Kill pid