StudioTime
StudioTime

Reputation: 23959

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?

Upvotes: 8

Views: 9902

Answers (1)

semsem
semsem

Reputation: 1192

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 &");

Upvotes: 13

Related Questions