in reply to Re: When to use Autoflush
in thread When to use Autoflush

Second, if the information you send has a positional aspect (as in, the HTTP headers must precede the content). If the potential exists that an error message may go out before the full headers, you may disable buffering.

This actually brings us to another caveat: Don't mix buffered and unbuffered output. If your script writes to STDOUT and STDERR, and both of these somehow find their way through the network connection, note that STDOUT is buffered by default but STDERR is not. This is why you'll occasionally see "errors" appear before the actual output. The output is being mixed and naturally buffered output will appear later.