I have recently created a script that needs to be run on background.. I use this code to run it...
function run_in_background($Command, $Priority = 0) {
if($Priority)
$PID = exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!");
else
$PID = exec("nohup $Command 2> /dev/null & echo $!");
return($PID);
}
and use it like this
run_in_background('curl http://www.mydomain.com/mypage.php',5);
Unfortunately, it is not running on background...
I have also used:
shell_exec
instead of
exec
But it still doesn't work.. Is there something wrong with my setup?..
Note: it doesn't run in background but it sure runs when the page is loaded...
thanks in advanced..