L
L
Leonid2019-05-24 11:17:43
PHP
Leonid, 2019-05-24 11:17:43

How to make flush() work in PHP on a "long-playing page" under nginx with GZip compression?

There is a site on WordPress
On the server:
PHP 5.6 Server :
nginx/1.15.6
Accept-Encoding: gzip,
deflate
it works as it should.
and you need to issue in the process of the message through:

public function flush_message($message, $type='')
{
  printf( '<div class="flush-message %1$s">%2$s</div>', $type, $message ); 
  flush();
}

and I really don’t want to rewrite all this as it relies on AJAX calls - because it’s long and tedious and the code is old,
but at the same time the client using this functionality should see what’s happening and if you just need to stop loading the page.
Are there any solutions?
@ini_set ( 'zlib.output_compression', 0);
@ini_set ( 'implicit_flush', 1);
@ob_end_clean();

something does not help as they say...
Disabling Gzip compression is also not an option....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-05-24
@dodo512

nginx.org/ru/docs/http/ngx_http_fastcgi_module.htm...
Add a separate location for the page Or add in the script itselffastcgi_buffering off;
header('X-Accel-Buffering: no');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question