Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell_exec not running in background?

I have the following which executes perfectly but NOT in the background as it should? It actually stops the page loading until it finishes which is not good.

shell_exec("/usr/bin/php /home/public_html/pages/test/backg.php {$user_info} {$user_info2} {$user_info3} &");

I also tried

exec("/usr/bin/php /home/public_html/pages/test/backg.php {$user_info} {$user_info2} {$user_info3} &");

I thought the

&

meant it would execute then let the holding page carry on regardless?

like image 563
StudioTime Avatar asked May 06 '12 17:05

StudioTime


1 Answers

exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));

php execute a background process

exec("/usr/bin/php /path/background.php > /dev/null 2>&1 &");
like image 87
semsem Avatar answered Oct 15 '22 06:10

semsem