php-fpm and realtime flushing

Discussion in 'General' started by lukav, Sep 10, 2018.

  1. lukav

    lukav New Member

    I have a setup with Debian 9 installation and
    ##### ISPCONFIG #####
    ISPConfig version is 3.1.13
    The site is using php-fpm version 7.1 installed from deb.sury.org
    I want to pass data to the browser as soon as the php outputs it, so no timeouts are reached and the user knows the state of the process.
    However I cannot make this work with this ispconfig setup.
    On another server where php is loaded as module there is no such problem.
    Please help.
    Here is the mytest.php file I'm working with:
    PHP:
    <?php
        
    @ini_set('zlib.output_compression',0);
        @
    ini_set('implicit_flush',1);
        @
    ini_set('output_buffering''Off');
        @
    ini_set('output_handler''');
        @
    ini_set('implicit_flush','On');
        @
    ob_implicit_flush(1);
        @
    ob_end_clean();
        
    header('Content-Encoding: none');
        
    header("Cache-Control: no-cache, must-revalidate");
        
    header('Content-Type: text/plain');
        
    header('X-Accel-Buffering: no');

    foreach(
    range(1,9) as $n){
        echo 
    $n."\n";
        
    flush();
        
    sleep(1);
    }
     
  2. Jesse Norell

    Jesse Norell Well-Known Member

  3. lukav

    lukav New Member

    I've tried many options and suggestions from stackoverflow and also when over the docs, but nothing worked.
    The option of streaming empty characters till you get 4096 bytes, works but it is not a solution for me, since the output would become a mess.
    :(
    I guess I'll have to switch to mod-php, as this works like a charm.
    Will have to wave the pros and cons between mod-php itk and php-fpm
     
  4. Jesse Norell

    Jesse Norell Well-Known Member

    Another option might be switch to nginx; I have no first-hand experience or a test system ready, but a quick google search at least sounds like it's configurable to disable buffering.
     

Share This Page