php - How to correctly show output at every echo on all browsers? -


I moved my files to a new server and I have a script that instantly shows output on every echo > On the browser, but it is not working on the new server. Here is my test code:

  @ini_set ('output_buffering', 0); @ini_set ('implicit_flush', 1); For ($ i = 0; $ i & lt; ob_get_level (); $ i ++) ob_end_flush (); Ob_implicit_flush (1); Ignore_user_abort (true); Set_time_limit (0); $ Max_wait_time = 30; $ Start_time = Microtom (true); $ Elapsed_time = 0; While (! Connection_aborted ()) {echo $ i ++ Str_repeat ('', 1020). '& Lt; Br / & gt; '; Flush (); Ob_flush (); Usleep (1000000); If ($ elapsed_time & gt; $ max_wait_time) {break; } $ Elapsed_time ++; }   

I have tried some things that have been mentioned above but have to start production buffering and flushing has not worked for me. I tested it on Chrome and Firefox, they Both end up producing everything.

Any thoughts?

Excerpt from:

flush () your web The server can not be able to override the buffering scheme and it has no effect on any client-side buffering. [...]

Many servers, especially on Win32, will still buffer output from your script unless the result ends before sending the transmitter to the browser.

The server module Mod_gzip for Apache can buffer its own, so that the result of flush () is not in the data being sent to the customer immediately.

Chances are you have a separate web server (or web server configuration) that buffer the entire script output before it is output.

Comments