title: Shell_exec php with nohup
body: <p>I think there are tons of similar posts but I haven't yet found a solution after searching around.</p>
  
  <p>Basically, I'm trying to run two scripts in the background. When I run them in the commandline, I see after calling my first script:</p>
  
  <pre><code>/usr/bin/nohup php script.php &gt; nohupoutput.log &amp; echo $!
  </code></pre>
  
  <p>I've tried  <code>...script.php &gt; /dev/null &amp;</code> with the same result. I get:</p>
  
  <pre><code>/usr/bin/nohup: ignoring input and redirecting stderr to stdout
  </code></pre>
  
  <p>which I ignore and run the second one. I noticed that it seemed to be hanging there, and pressing <kbd>Enter</kbd> brought me back to <code>machine:~folder&gt;</code></p>
  
  <pre><code>/usr/bin/nohup php script2.php &gt; nohupoutput.log &amp; echo $!
  </code></pre>
  
  <p>Both scripts work. I tried to then convert this to a shell_exec command and nothing seems to work. I suspect that the <code>ignoring input</code> bit is causing difficulties, but I'm not sure. Regardless, the following does not work. It just hangs in the browser:</p>
  
  <pre><code>$output = shell_exec('/usr/bin/nohup php script.php &gt; /dev/null &amp;');
  $output = shell_exec('/usr/bin/nohup php script2.php &gt; /dev/null &amp;');
  </code></pre>