Question

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?

Was it helpful?

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.

OTHER TIPS

The most common usage of output buffering is actually to allow your scripts to begin "writing" page content via print/echo/etc. yet still allow header() calls later in the script to work properly (since headers can only be sent before any actual page content is). If your scripts make use of such, then you'll need to leave output buffering on in order for your scripts to continue functioning with all header() calls behaving properly. (Otherwise you'll get the wonderful "header(): Warning, could not modify header information, headers already sent" message.)

You really only need OB when you're trying to store information that would otherwise always be outputted to the screen. For example, OB is good for storing the parsed output from an included file.

If you're not using OB for those types of thins, then there are other, more efficient ways of going about it, and you should inquire about them here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top