增量显示PHP输出可在localhost上运行,但在远程服务器上不起作用

I have used the following code to incrementally stream PHP output to JavaScript via AJAX:

ini_set('output_buffering', 'off');
ini_set('zlib.output_compression', false);

while (@ob_end_flush());

ini_set('implicit_flush', true);
ob_implicit_flush(true);

header("Content-type: text/plain");
header('Cache-Control: no-cache');

for($i = 0; $i < 1000; $i++) {
  echo ' ';
}

// show output here

This works fine for me on localhost, but I've tried with three different remote servers, all of which don't work.

What is the reason for this? I can provide more code as necessary.