Nginx environment PHP flush failure solution, nginxflush
Problem
When I debug PHP line-by-line output, I found thatOb_flushAndFlushBoth of them are invalid. You can use phpinfo to determine whether the php. ini settings are normal.
Solution
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 phpOb_flushAndFlushOutput a piece of content that reaches 4 K, for example:
Echo str_repeat ('', 1024*4 );
By now, PHP can passOb_flushAndFlushOutput the required content line by line.
Summary
The above is all about this article. I hope this article will help you in your study or work. If you have any questions, please leave a message.