php

ob_start() – output handler ob_gzhandler conflicts with zlib output compression

In my PHP 5.4.x setup, an old project which uses ob_start() and ob_whatever() started to throw errors like Warning: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression'. On my development environment, I suppress this error by disabling zlib compression on this specific vhost.

The error

Below is the full error message I get.

Warning: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' in /home/lysender/projects/foo/bar/index.php on line 6

Notice: ob_start(): failed to create buffer in /home/lysender/projects/foo/bar/index.php on line 6

After a quick research, I got a hint that disabling the zlib compression will suppress this error. Since I’m on a vhost, I can just disable this zlib compression only in this specific project. Therefore firing up vim, I added this line on my vhost definition.

...
    php_value zlib.output_compression off
</VirtualHost>

Then restarted apache, then the warning is gone.

/etc/rc.d/rc.httpd restart

I haven’t experienced this much problem when I’m using PHP 5.3.x and even the early PHP 5.4.x on my Linux distro. Maybe something has changed that made this warning cry wolf.

2 thoughts on “ob_start() – output handler ob_gzhandler conflicts with zlib output compression”

  1. Eu apenas removi a seguinte linha ob_start(‘ob_gzhandler’); (linha 7) e funcionou tudo ok

Leave a reply

Your email address will not be published. Required fields are marked *