PHP script not echo'ing logs in real time - Was working on my other server
<p>I wasn't sure how to title this thread, sorry.</p>

<p>I have a script that processes some logs and I <code>echo</code> a lot of debug information as the process goes. Since moving to the new server, it seems that the script hangs for 30 odd seconds, then spits out all the logging, then hangs again for 30 odd seconds and the process continues.</p>

<p>This is really odd behavior and I don't know where to start. Its like it isn't processing the file line by line but in blocks ...</p>

<p>PHP version is 5.1.6 on a CentOS running plesk. (My old CP was CPanel)</p>

<p>Any ideas?</p>

<p>EDIT: Simple example of my issue - Running this code:</p>

<pre><code>for ($i=0; $i&lt;100; $i++) {
echo "test $i";
sleep(1);
}
</code></pre>

<p>the script will hang for 100 seconds, then print out all the "test 1" ect. Sleep is required in my main script and on the other server just echoed the values in turn.</p>

<p>EDIT2: Have tried setting output_buffering = 0 and implicit_flush = On and didn't help.</p>
