$command = 'yourcommand' . ' > /dev/null 2>&1 & echo $!; '; $pid = exec($command, $output); var_dump($pid);
Here is what the above code is Doing:
1. The exec() function is used to execute an external program and return the last line of output.
2. The $command variable is set to the command you want to run.
3. The $output variable is set to the output of the command.
4. The $pid variable is set to the PID of the command.
5. The var_dump() function is used to display the contents of a variable.