There are several entries on this subject, for example here and enter, but none of the suggestion does seem to work. I have an example here:
$pid = shell_exec("nohup sleep 10 2> /dev/null & echo $!");
echo $pid;
which I expect to start a new command sleep 10 in the background, and return immediately to the shell. But the found behavior is that this code 'waits' for the execution of the subcommand sleep 10.
How can I run my commad in the background as a new process?