Take the 2-minute tour ×

I am trying to run this php script in my linux based server.

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

//Endless loop because the data here updates around the clock 

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


    }//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");

}//end of endless loop 

and it workes fine if I run it from a simple browser (ofcourse it stops working when I close it).

I am trying to run it through a perl script

exec('indices.php');  #tryed also system("php indices.php");

and run the perl script like so

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

but it doesn't work when I am trying to run it from the server.

share|improve this question
its called a Daemon, google "php Daemon" –  Dagon Jun 21 '12 at 21:56
Why do you say "it doesn't work"? What specifically occurs? Is it running but functions incorrectly? Does it not run at all (ps -A shows nothing)? –  webbiedave Jun 21 '12 at 21:59
Setup a cron job. Having infinite loop is not nearly remotely adviced. –  Ciro Jun 21 '12 at 22:16
add comment

1 Answer

By looking at the code your probably better to setup a CRON job. If your server doesn't support CRON then you could try adding...


or try adding -q to the php command like so:

php -q /home/user/example.php
share|improve this answer
add comment

Your Answer


