For anyone who ended up here, my solution was to make a php script that takes a script as an argument. The new script is called into the background and appropriately processes exit statuses.
For instance:
$cmd = 'php asynchronous_script.php -p 1'; exec("PHP _executor.php -c'$cmd' &");
The second script looks something like
$opts = getOpt('c:'); $cmd = rtrim($opts['c'], '&'); $exitCode = 0; $output = ''; exec($cmd, $output, $exitCode); if ($exitCode > 0) { ... }
source share