PHP sleep() function killing script after some time
<p>I am experiencing a problem when using sleep() function in php for a long period of time, if i test the following code all runs perfectly:</p>

<pre><code>&lt;?php

set_time_limit(0);

$i = 0;

while($i &lt; 10) {

    echo $i.'&lt;br /&gt;';

    if($i == 5){        
        echo 'sleeping 5 secs&lt;br /&gt;';
        sleep(5);   
        echo 'waking up&lt;br /&gt;';
    }

    $i++;
}

?&gt;

*****OUTPUT****

0
1
2
3
4
5
sleeping 5 secs
waking up
6
7
8
9

*****OUTPUT****
</code></pre>

<p>It sleeps 5 seconds and after that the "waking up" is echoed without problems, but, if I raise the amount of seconds the script is sleeping to lets say 15 minutes the output is the following:</p>

<pre><code>*****OUTPUT****

0
1
2
3
4
5
sleeping 900 secs //(15 mins)

*****OUTPUT****
</code></pre>

<p>The script appears to be killed after 15 minutes of sleeping!!, what could be causing this? note that I set the max_execution_time flag to infinite with set_time_limit(0); at the top of the script.</p>

<p>I will appreciate any help, thanks!</p>
