From: robert on
I have a script that retrieves several queued email messages from a MySQL
database and sends them out, printing out progress as it goes along; for
example:

email1(a)example.com ... sent
email2(a)example.com ... sent
email3(a)example.com ... sent

Either "sent" or "failed" is displayed based on the result of the mail() call.

When accessing the script however, the browser(?) waits until the script has
completely processed prior to displaying the page (instead of displaying it in
progress). Other scripts on the same system display in progress, and it's
unclear what's different/special about this one.

The page header contains several hundred characters, and line breaks are
included after each "sent", so I don't think it's a browser buffering issue.
The behavior is the same in both Firefox & IE.

The engine is PHP 5.2 under Apache. And none of the ob_ functions are being
used. I did try adding a flush(), but the behavior is still the same.

So what else could cause the page to buffer completely prior to being
displayed?

Any insights appreciated,
Robert

From: robert on
Additional info:

php.ini has output_buffering=4096. Calling flush() or ob_implicit_flush()
within the script doesn't seem to help. However setting
php_value output_buffering off
in .htaccess does the trick.

Any ideas what else to try? Would like a script-only solution that is not
php.ini/htaccess dependent.

Thanks,
Robert