Running PHP script in background
<p>I am testing a php script that has been developed on an OS-X system at Debian and it behaves different there.</p>

<p>To reproduce it I wrote two scripts: parent.php and child.php:</p>

<p>parent.php:</p>

<pre><code>#!/usr/bin/php
&lt;?php

echo "parent started...\n";
shell_exec(__DIR__ . '/child.php &amp;2&gt;/dev/null &amp;');
echo "parent finished.\n";
</code></pre>

<p>child.php:</p>

<pre><code>#!/usr/bin/php
&lt;?php

echo "child started...\n";
sleep(5);
echo "child finished.\n";
</code></pre>

<p>Running parent.php on OS-X I get back imediately the two output lines (parent started, parent finished). On Debian I get the "parent started..." line, then a delay of 5 seconds an then the "parent finished.". Running "./child.php &amp;2>/dev/null &amp;" in the shell gives me back the prompt imediately as expected. Any ideas how I can fix this?</p>
