I have searched a lot to find the exact answer but didn't find any.
many people mentioned that we should & at end of command to don't wait for response.
for example to run bg.php in background , this was recommended:
exec("/usr/bin/php bg.php &");
but it doesn't work for me. and the main script waits for complete execution of the bg.php.
I also read somewhere to write bg.php output in a logfile but my background script doesn't produce any output. It does some process and then write something in database.
I just want my script to run bg.php and don't wait for it to end.
please help me including correct code.
You have to reroute programs output somewhere too, usually /dev/null
exec($cmd . " > /dev/null &");