When debugging PHP line-by-line output, it is found that both ob_flush and flush are invalid. Through phpinfo, the php. ini settings are normal.
Check Nginx again and find that Nginx has the following settings:
Fastcgi_buffer_size 128 k;
Fastcgi_buffers 8 128 k;
The problem is basically found. Nginx will buffer the PHP output information and send the data in the buffer zone to the client only when it reaches K. Then we need to reduce the buffer zone first, for example:
Fastcgi_buffer_size 4 k;
Fastcgi_buffers 8 4 k;
In addition, gzip must be disabled.
Gzip off;
Then, in php, before ob_flush and flush, output a piece of content that reaches 4 K. For example:
Echo str_repeat ('', 1024*4 );
By now, PHP can output the required content through ob_flush and flush row by row.
Note: IE must receive 256 bytes before Display starts.
Therefore, we need to add echo str_pad ("", 256 );