Home: Other Programming Languages: PHP:
Background process in PHP



dkhanna01
Novice

Sep 11, 2009, 1:15 PM


Views: 33941
Background process in PHP

I have a PHP code snippet which reads as:

$cmd = "cd ~/stpbuild && build.sh dev:package < $my_file";
$cmd = $cmd.' & echo $!';

exec($cmd,$op);

Now the first line is running the 2 shell command which I need to execute in this manner only (using 2 &&s).

Now when I'm executing it via "exec" the command is executing successfully but in background which it should as I'm trying to run this process in background in second line "& echo $!"

Any idea why this command does not going in to background ???