Processes create/join

I'm working with some code in php that creates a process and I want the main program to wait till that process is done running then come back and join.
<code>
$pid = pcntl_fork();
if ($pid == -1){
die('could not fork');
}
else if ($pid){
pcntl_wait($status);
}
else{
echo shell_exec($command);
}
<code>
$command is a variable which has the name of the program (and it's arguments) I am trying to run as a new process and that's what I want to wait for. I'm pretty new at this php stuff so if anyone could help with this I'd appreciate it.

Additionally if it is possible to display something to the web page screen to let the user know the process is working(because it takes a minute or so) and then let them know once the process has joined that would also help immensly. Thanks for your help with this.

bump. need :confused:help