Warning: ob_start () [ref.outcontrol]: output handler 'ob_gzhandler' conflicts with zlib output compression '

I use Gzip compilation and Zlib compilation to speed up my website.

I used below code

ob_start("ob_gzhandler"); in a shared file that is included on all pages and

 lib.output_compression = On 

But after that I get an error like

 "Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' conflicts with 'zlib output compression' in E:\xampp\htdocs\projects\trunk\index.php on line 2" 

Can someone tell me what's wrong with that?

+7
source share
6 answers

Search string below in php.ini file:

zlib.output_compression = On

edit for:

zlib.output_compression = Off

+3
source

You should check if the zlib library is loaded, then clear the output buffering shutdown by doing ob_end_clean()

You can add this line to the beginning of the file: <?php if (extension_loaded('zlib')){ ob_end_clean(); ob_start('ob_gzhandler');} ?> <?php if (extension_loaded('zlib')){ ob_end_clean(); ob_start('ob_gzhandler');} ?>

+3
source

In php.ini find 'zlib' and go to On

0
source

Recommendation: do not use PHP Zlib compression, disable it

but try to enable output buffering

What helps the processed HTML is launched to the buffer immediately, without waiting. This helps speed up some miles.

Do not use too much PHP echo for regular HTML codes.

Using

  • Gzip Web Server Compression
  • Minimize HTML Outputs
  • Use Opcache and Static generators to speed up your site by 100%.
0
source

Same. You only need to do one of them, not both.

-one
source

I had the same problem and your answer was very helpful.

Search string below in php.ini file:

zlib.output_compression = On

edit for:

zlib.output_compression = Off

However, I could not figure out where to find the php.ini or zlib file. I took a few days off and I looked at it from a new perspective. My hosting provider "Hostinger" http://api.hostinger.in/redir/21246281 uses the new control panel and you will get access to the PHP settings here: ps for cpanel users I will update the update if necessary.

The following is an example php configuration page in the Hostinger panel:


PHP configuration


PHP version

PHP 5.2
PHP 5.3
PHP 5.4
PHP 5.5
PHP 5.6
PHP 7.0
Choose which version of PHP you want to enable for your account.

Zlib compression

Included
Off

To transparently compress pages. If this parameter is set to "On" in php.ini, pages are compressed if the browser sends the header "Accept-Encoding: gzip" or "deflate". The headers "Content-Encoding: gzip" (respectively, "deflate") and "Vary: Accept-Encoding" are added to the output. At run time, it can only be set before sending any result.

Display errors

Enabled / Disabled This determines whether errors should be printed on the screen as part of the output or if they should be hidden from the user. Max input vars

Here is an example php configure admin panel page to make changes. Hope this helped someone. goodloktimes@gmail.com

-2
source

All Articles