If you want to run php script as daemon process? Yes, there are some drawbacks, but not possible to control? That’s just wrong.
A simple kill processid
will stop it. And it’s still the best and simplest solution.
Here is a basic example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php /* Remove the execution time limit */ set_time_limit(0); /* Iteration interval in seconds */ $sleep_time = 600; while (TRUE) { /* Sleep for the iteration interval */ sleep($sleep_time); /* Print the time (to the console) */ echo 'Time: ' . date('H:i:s'); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.