Tristan wrote:
So, I'm have this site where all this code was developed and the logic sits
in different plugins throughout a template. So, html is output and then hits
one of these plugins. Plugins do some processing and then hit a
header(location...) redirect.

So, problem is they developed code with these header redirects and now we
there's too much html being output so we get the buffer errors

Cannot modify header information - headers already sent by (output started

to fix we have to up the buffer ouput in the php to something really high.

So, as far as I know this is not good coding practice and upping the output
buffer is really masking the problem.

Is there another way to work around this like another way to do redirects
that won't cause these buffer probs?

Hi Tristan,

Really it's a nudge from your code that it needs refactored - however to answer your question..

- there is no way to do an HTTP redirect once headers are sent
- you can use an html meta refresh, or javascript redirect - if the output is going to be HTML viewed in a browser.

caveat, obviously robots and the like will still see the incorrect output - it's a hack not a fix.

The other approach is to use ob_start() and related functions to capture all the code generated without any output being sent to the browser, this should allow you to send the header down when needed.

Certainly wouldn't just knock output buffering right up high to work around it if I was you.



PHP General Mailing List (
To unsubscribe, visit:

Reply via email to