I have written php program and uploaded on server. I want run this program infinitely. My programs source is like this:
<?php
while (1<2){
make something;
}
?>
Of course, if i will open this page in my browser it will run, but if i will shut down my pc it will stop working. How i can run this program infinitely without opening in any browser.
<?php if (isset($_SERVER['HTTP_HOST'])) { exec("php ".__FILE__." > /dev/null 2>&1 &"); exit; } // Do stuff here. In Windows it is too long winded for a comment. Basically, when called through a browser,exec()yourself and release the association with the new process.