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 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);
Reply to discussion (solution)
In cli mode
Kill pid Wrong, yes
ignore_user_abort(1);
In cli mode
After kill the pid, you can write it like you do. if I didn't write getmypid on it... I can only go to linux to find it?
In cli mode
After kill the pid, you can write it like you do. if I didn't write getmypid on it... I can only go to linux to find it?
It's hard to find a process without a pid, isn't it?