Should I leave output_buffering on or off in a production environment?

I am about to start a website and I go to my php.ini to get all the settings ready for a production environment.

I am debating whether to leave output_buffering On, Off, or set a buffer limit (like 4096). Is there a pro or con to turn output_buffer on or off? I read that disabling the buffer will give you some extra performance, but is there anything I should know before making a decision?

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

+2


source to share


3 answers


This is a configuration directive, other than register_globals

and magic_quotes_runtime

, in which it is not inconsistent enough to ensure that it is retained by default. Leave it enabled if you need it (this is what I would do). As far as I know, there is no obvious security hole in this that comes from this.



+2


source


The most common use of output buffering is to allow your scripts to start "writing" page content using print / echo / etc. but still allowing header () calls later in the script to work as expected (since headers can only be sent before the actual page content is displayed). If your scripts use these, then you will need to leave output buffering in order for your scripts to continue to function, and all header () calls behave correctly. (Otherwise you will get a wonderful header (): Warning, could not change header information, messages sent have already been sent.)



+4


source


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

If you are not using OBs for these thins types, then there are other, more efficient ways to get around this, and you should learn about them here.

+2


source







All Articles