php-fpm and realtime flushing

Discussion in 'General' started by saits1947, Nov 7, 2018.

  1. saits1947

    saits1947 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. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig has mod_php as well as PHP mode when your server uses apache, so you can use the same PHP mode that you use on the old server. So the difference here is the php mode, if the server has ISPConfig installed or not does not matter for the above problem.

    If you can't use mod_php e.g. because your new server uses nginx, then take a look here:

    https://www.jeffgeerling.com/blog/2...output-buffering-php-apache-nginx-and-varnish

    the post also describes how to disable output buffering with apache in case you are using apache wand want to keep using php-fpm as php mode.
     
  3. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

Share This Page