PHP Run Background Process using Exec
If you need to start process in background and get its PID to manage it later using PHP. <?php function runInBackground($command,$log,$priority=0) { if($priority) $PID=shell_exec(“nohup nice -n $priority $command > $log 2>&1 & echo $!”); else $PID=shell_exec(“nohup $command > $log 2>&1 & echo $!”); return($PID); } ?> echo $! will return process ID # Command & … Read more