Shell_exec not working in the background?

I have the following that runs fine, but NOT in the background, how should it be? This 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 that

&

meant that this would be done, then let the holding page be executed independently?

+3
source share
1 answer
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));

php execute background process

also i found this:

exec("/usr/bin/php /path/background.php > /dev/null 2>&1 &");
+6
source

All Articles