Search code examples
phpoutput-buffering

Should I leave output_buffering On or Off in a Production Environment?


I'm about to launch a website and I'm going over my php.ini to prepare all the settings for a production environment.

I'm debating whether to leave output_buffering On, Off, or set it to a buffer limit (like 4096). Is there any pro's or con's to having the output_buffer turned On or Off? I've read that turning the buffer Off will give you some extra performance, but is there anything I should know before making my decision?

Why leave it off?
Why leave it on?
Why leave it on with a buffer limit?


Solution

  • It's a configuration directive unlike register_globals and magic_quotes_runtime in that it's not controversial enough to warrant keeping it off by default. Leave it enabled, in case you ever need it (it's what I'd do). As far as I know, there's no glaring security hole that arises from doing so anyway.