views:

85

answers:

1

I recently made the jump from php 5.2 to 5.3, and I've noticed that it will now allow redirects (ie. headers) after writing content, presumably through some sort of automatic output buffering.

I used to think it was annoying the other way... but this makes it much harder to track down errors during development. Is there a way to turn this option off in my php.ini file? Or is there a compelling reason to leave it, and I'll just learn to expect this behavior over time?

+2  A: 
output_buffering = off

In response to your second question, you should leave OB off. If you're in a situation where it is useful or necessary you can always turn it on using ob_start() in your code. If you leave it on in php.ini PHP will buffer all of your output, which can be annoying at times (its messed up my Ajax responses before too) especially if you forget to flush() at the end.

Jarrod