Good Idea To Use ob_gzhandler?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Good Idea To Use ob_gzhandler?

Post by volomike »

Is it a good idea to always use ob_gzhandler? Or, should I detect somehow if the end user's browser supports it, and then turn it on if it does? Or, does Apache handle this swapping for me? I'm still trying to understand this.
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: Good Idea To Use ob_gzhandler?

Post by volomike »

Or, should I just do this in the .htaccess file instead?

http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Good Idea To Use ob_gzhandler?

Post by Eran »

The ob_gzhandler callback is supposed to detect whether the browser supports gzip encoding (and the type of gzip) and send output accordingly. I say "supposed to", since it relies on the browser to correctly inform it of its capabilities. This generally works fine, however some older versions of IE6 sometime have problems with this.
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: Good Idea To Use ob_gzhandler?

Post by volomike »

Found an answer that seems good:

http://nadeausoftware.com/node/33

According to the mod_gzip documentation, very old web browsers prior to Internet Explorer 4, Netscape 6, and Opera 5 do not properly support compressed files. Fortunately, according to monthly browser statistics reported by W3schools.com, these old browsers dropped below 1% market share way back in 2003. While you can configure the compression modules to handle these browsers specially, it hardly seems worth the effort. Internet Explorer 5.5 and 6 had a rare problem with compressed JavaScript files. A patch was distibuted as a service pack back in 2002. It is unlikely that unpatched IE 6 browsers remain a significant part of the user base any more.

It sounds like I should disable the INI setting with php_value setting in my .htaccess file, and then to turn it on in the .htaccess file. And then of course one has to install mod_deflate. But, it's on my web hosting provider and my workstation, so I'm okay.
Post Reply