Forum Moderators: coopster

Message Too Old, No Replies

problem with a very simple php script

         

Algebrator

5:24 pm on Mar 25, 2009 (gmt 0)

10+ Year Member



I would appreciate if you could take look at the following php script

<?php
@ob_end_flush(); ob_implicit_flush() ;
for ( $i = 0 ; $i < 300 ; $i++ )
{
print "$i <br />\n" ;
sleep( 1 ) ;
}
?>

On several servers it works like you would expect (displays numbers from 1 to 300)

However on one of them it waits 300 seconds and then starts displaying numbers.

Hosting tech support was of no help expect for telling me that it probably has to do with php settings.

If you have an idea of what is happening here, please let me know. (It is not that I really need the above script working, but that is the "essence" that my programmer was able to pinpoint as a reason for some more complicated scripts not working)

Thank you very much for any ideas on thi

whoisgregg

6:15 pm on Mar 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The manual page for ob_implicit_flush [php.net]() shows that you need to pass either true or false to, respectively, turn it on or off. Try:

ob_implicit_flush(true);

Also, look at the comments on the manual page, you may find that changing the order of ob_implicit_flush(); and ob_end_flush(); will be helpful.