PHP's ob_flush() causing error
Asked Answered
R

2

9

When I call PHP's ob_flush() function on my localhost (via MAMP) I get the following error:

Notice: ob_flush() [ref.outcontrol]: failed to flush buffer. No buffer to flush.

The only solution I can find is to prefix it with @, but this doesn't seem like a real solution to me. What's causing the problem?

Rackrent answered 14/7, 2010 at 4:40 Comment(0)
J
15

The error message would seem to imply that you're not actually using output buffering when you call ob_flush(). Have you called ob_start() previous to invoking ob_flush()?

Johm answered 14/7, 2010 at 4:46 Comment(0)
D
9

If you want to use ob_flush you must first call ob_start() - desirably at the top of your page.

Not sure if it fits your needs but you might want to also try the plain old flush(), just guessing.

Discommend answered 14/7, 2010 at 6:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.