Checking PHP output buffering?

Possible duplicate:
PHP - How to detect if output buffering is enabled

How can I check PHP if output_buffering is set to On? I have to fix the problems on the site and I do not have access to the hosting panel.

Something like:

if(output_buffering == 'On') { echo 'It is On'; } else { echo 'It is NOT On'; } 

Thanks!

+2
source share
2 answers

You must do this with ini_get() . I have not tested it, but I am sure that it will meet your needs, as ini_get() used for this purpose: checking php.ini parameters.

+2
source
 if(ob_get_level() > 0){ //there are some buffers active. } $ php -d output_buffering=1 -r'var_dump(ob_get_level());' int(1) $ php -d output_buffering=0 -r'var_dump(ob_get_level());' int(0) 

However, it checks to see if there is an active output buffer, not the actual configuration of PHP itself. The ob_start() manual (or more than one) will also increase the level. This is usually more interesting than the actual output_buffering . If you really need it, fo with the answer ini_get .

+9
source

All Articles