I have this example script:
<?php
$time = time();
shell_exec('nohup sleep 30 2>/tmp/test >/tmp/test &');
$time2 = time();
echo $time2 - $time;
?>
when I run it for the first time it show immediately 0 , but when I run it for the second time it wait for the sleep command to finish the it shows the 0. what should i do to make it run immediately without waiting for the sleep command ?