how do I turn on output_buffering for every request to my Sf2 app?
I need this to use the the FirePHPBundle, but I would prefer to have it application-wide.
A good place to do this is in AppKernel's init
method where the framework also registers various error handlers and debug flags:
class AppKernel extends Kernel
{
...
public function init()
{
parent::init(); //do not forget to call this
if ($this->debug) {
ob_start();
}
}
}
This of course will call ob_start only in a development environment
You need not to worry about calling ob_start
here because as the php manual states:
Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.