Could someone please save these 2 files and run them and tell me why I get the error \" ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush\". I tried go
I think you are confusing ob_flush()
with flush()
. While ob_start()
and ob_flush()
handles a PHP internal output buffer that catches all outputs, flush()
is the normal function that flushes STDOUT
like in other programming languages.
Example:
EDIT:
Your output is not printed, because your webserver may buffer the contents. Try to turn off compression and output buffering:
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
Please also keep in mind, that Safari and Internet Explorer have an internal 1K buffer. So you need to add 1 KB of padding data (like spaces), to make them render.
EDIT 2: Your implementation is broken. You want to poll your data with ajax. Use jQuery on the client side:
0%
Then in script-that-returns-stuff.php
: