以无休止的循环运行php文件

以无休止的循环运行php文件,php,linux,perl,Php,Linux,Perl,我正在尝试在基于linux的服务器上运行这个php脚本 $today = strtotime("today"); $tommorow = date("Y-m-d", strtotime("+1day",$today)); $today = date("Y-m-d"); //Endless loop because the data here updates around the clock while(1){ while (time() <= strt

我正在尝试在基于linux的服务器上运行这个php脚本

$today      = strtotime("today");
$tommorow   = date("Y-m-d", strtotime("+1day",$today));
$today      = date("Y-m-d");

//Endless loop because the data here updates around the clock 
while(1){

    while (time() <= strtotime("$tommorw 8:00PM")){

            sleep(30);
            flush();
        }

    }//end 24 h loop
    //save the file as a date file and delete it's content


    //move on to the next day   
    $today      = strtotime("today");
    $tommorow   = date("Y-m-d", strtotime("+1day",$today)); 

}//end of endless loop 
然后像这样运行perl脚本

./PROMadadim.pl >> ./PROMadadim.log &

但当我试图从服务器上运行它时,它不起作用

通过查看代码,您可能会更好地设置CRON作业。如果您的服务器不支持CRON,那么您可以尝试添加

set_time_limit(0);
或者尝试向php命令添加-q,如下所示:

php -q /home/user/example.php

它被称为守护进程,谷歌的“php守护进程”你为什么说“它不工作”?具体发生了什么?它是否正在运行但功能不正确?它根本不运行(
ps-A
什么也不显示)?设置cron作业。拥有无限循环几乎是不可能的。
php -q /home/user/example.php