defeat buffered output in PHP for realtime display?

aww

Well-Known Member
#1
Some of the tricks I try to use in PHP to typically defeat the output buffering to diagnose the output of long scripts does not seem to be working with LiteSpeed.

I suspect this is because LiteSpeed tries to gather the output so it can compress+chunk it (typically in 4k blocks).

Is there any trick I can use to defeat the buffer effect on a per-script basis?

None of these solve the problem:
ini_set('output_buffering', 0);
ini_set('implicit_flush', 1);
ob_end_flush();
 
Last edited:

aww

Well-Known Member
#2
It took a bit of googling but I found the answer that works on apache and I believe it works on LiteSpeed as well:

after each echo, or other output, put a:
ob_flush(); flush();

(I had only put ob_flush(); )
 
#3
Hi there.

Sorry to bump a 4 year old thread but I couldn't find a more relevant thread and I'm having the same issues.

No matter what variations of code I use I'm not able to flush the output buffer

ie.

PHP:
ini_set('output_buffering', 0); 
ini_set('implicit_flush', 1);
ob_end_flush();

for($i=0; $i<10; $i++){
    echo $i;
    sleep(1);
    ob_flush();
    flush();
}
Has anyone else been able to successfully flush(); ?
 
Top