How to run a Run a PHP Script for every half an hour with out cronjob ?
You can do it checking last update date for a file (that acts as flag).
index.php (or any file)
<?php
$stat = stat("flag.txt");
if(check if your $stat['mtime'] has more of 30 mins of last modification) {
//run your script
touch("flag.txt")
}
?>
Other than PHP code, this could be achieved by a messaging queue systems which is recommended.
Use sleep
method in php script
like this
while(1)
{
//what do you want write here
sleep(30*60)
}
because sleep method of php is work in seconds check this link click here
You can run your code in terminal,this is the alternate of unix cron
php filename.php