defeat buffered output in PHP for realtime display?

Discussion in 'PHP' started by aww, May 2, 2008.

  1. aww

    aww New Member

    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: May 2, 2008
  2. aww

    aww New Member

    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. Mitch

    Mitch New Member

    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(); ?
  4. Mitch

    Mitch New Member

    Please note that I've disabled gzip compression (and dynamic compress) on litespeed and it's made no difference
  5. NiteWave

    NiteWave Administrator

    what's your lsphp5 settings?

    check

    Server->External App->lsphp5
  6. Mitch

    Mitch New Member

    Specifically which settings?
  7. Mitch

    Mitch New Member

    Persistant Connection is on, Instances is set to 1, Response Buffering is set to No.

    Is Response Buffering the issue here?

Share This Page