Ignore_user_abort (1) and set_time_limit (0) then set an infinite loop. how can this problem be terminated?

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.