Async linux shell call from php not working
<p>I'm stuck with a problem with an async shell call (from PHP), that simply isn't async, even though it should be.</p>

<pre><code>exec("nohup sudo -H -u ubuntu /usr/local/bin/purge.sh $purgeString &amp;&gt; /dev/null &amp;");
</code></pre>

<p>The script above is hit about 17 times in this one request type, so parallel operations is a must here!</p>

<p>WITHOUT the above operation (commented out) the request takes about 4 seconds. WITH the above operation, it takes 15+ seconds, which definitely means that the async part isn't working.</p>

<p>purge.sh writes its progress to a log file, and I can tail the log and see the entries come slowly and sequentially from each of the 17 operations.</p>

<p>I've tried all the solutions in <a href="https://stackoverflow.com/questions/222414/asynchronous-shell-exec-in-php">Asynchronous shell exec in PHP</a> and have had zero success.</p>

<p>[MORE INFO] - 
I can run the command manually in the shell, as another user, and it works as expected. The file and folder permissions also seem to check out.</p>

<p>Anyone have any insights in what could be wrong?</p>

<p>OS: Ubuntu 14.04, PHP: 7.08, Webserver: NGINX 1.11.2.</p>

<p>EDIT
We scrapped this approach. But if anyone answers, I'll still mark the correct answer.</p>