在后台运行php shell_exec [重复]

This question already has an answer here:

I had a file

run.php

the code is as followed

<?php

$shell_cmd = '/usr/bin/aria2c --on-bt-download-complete ./hook.sh "http://sometorrent.com/file.torrent"';

shell_exec($shell_cmd .' 2>&1 > out.log');

echo $shell_cmd;
?>

I tried run this script via website which is

http://mywebsite.com/run.php

My browser continue loading buffering sort of, until the torrent finish, how do i run in background so it execute right away in background.

</div>
<?php

$shell_cmd = '/usr/bin/aria2c --on-bt-download-complete ./hook.sh "http://sometorrent.com/file.torrent"';

shell_exec($shell_cmd .' > out.log &');

echo $shell_cmd;
?>

This will run the shell command in background