Multiple exec commands php
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4646788/php-in-background-exec-function">php in background exec() function</a>  </p>
</blockquote>



<p>I am trying to run two exec commands from PHP. One is a script that might run for a few minutes and there can only be once instance of it. The second exec just checks if the first process is running and either lets you run it again or redirects you. The code is something like this.</p>

<p>This is the main process</p>

<pre><code>$command = '/home/user/active/Nem-Swd.elf 30 &gt; /dev/null 2&gt;&amp;1 &amp; echo $!';
</code></pre>

<p>This is the process that checks if the other one is running already.</p>

<pre><code>exec("ps ax | grep $name 2&gt;&amp;1", $output);
</code></pre>

<p>I know that in the php API it says :</p>

<blockquote>
  <p>If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.</p>
</blockquote>

<p>But I don't understand what that implies.</p>
