PDA

View Full Version : Turning off Gzip



Eriksrocks
12-01-2009, 02:48 PM
As some of you may or may not have noticed, Bluehost has recently enabled gzip for all sites, at least on my server.

Normally this would not be a problem (and in fact it's great because loading times will be much smaller), but I had a script that required the output to be sent to the user as it was generated, not once the entire script was finished (otherwise known as output buffering). Gzip inherently buffers the output, so I had to find a way to disable it.

Thinking that mod_gzip was the problem, I tried adding "mod_gzip_on No" in my .htaccess file. Unfortunately, this gave me a 500 internal server error.

In a rather unhelpful response to my support ticket, one of the reps told me

Also, we don't have mod_gzip, but we do have
mod_deflate which is basically the updated version of this mod.

So I also tried "mod_deflate_on No" in my .htaccess file, but that didn't work either.

I finally stumbled upon the solution while searching on the Internet. Add this line to your .htaccess file:

SetEnv no-gzip dont-vary

If you want to turn off gzip for a specific file only, you can use this:

SetEnvIfNoCase Request_URI MY_FILE_NAME\.php$ no-gzip dont-vary

Obviously change MY_FILE_NAME to the name of the file.

This is working for me. It disables gzip compression and the accompanying output buffering. It should allow you to control output buffering via PHP if you want to, as well. :)

Since there's nothing mentioned in the knowledgebase, Bluehost no longer offers support for server/scripting issues via Live Chat (:mad:), and the ticket system wasn't very helpful on the issue, I thought I would post the solution here for future reference. Hopefully somebody benefits from it. :)

dovemaster
12-28-2009, 03:05 PM
I'm a bit confuzed :confused:

Do we need any stand alone decompression utilities to make this effective, like pkzip, or is winzip sufficient? I've gotten rid of all that, so I'm not sure...

lotosmot
01-20-2010, 09:38 AM
All modern browsers support gzip compression?
__________________
Tom

felgall
01-20-2010, 10:25 AM
I'm a bit confuzed :confused:

Do we need any stand alone decompression utilities to make this effective, like pkzip, or is winzip sufficient? I've gotten rid of all that, so I'm not sure...

No you don't need any decompression utility as the web browsers can all handle it internally (if they couldn't then there wouldn't be any point having it on as the browsers that can't decompress the page can't display it).

breakingball
01-30-2010, 09:09 AM
All modern browsers support gzip compression?
__________________
Tom Strap (http://toolsrate.com/straps/)

Yes, it's some older browsers that some people still use that don't fully implement gzip, but you can account for them in your site's root .htaccess file using something like this...



# This turn on compression for everything except things
# like images because they are already compressed
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|t?gz}zip|bz2|sit|rar|flv|pdf)$ \
no-gzip dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/htmlAlso see: http://developer.yahoo.com/performance/rules.html#gzip

rishk789
02-14-2010, 04:07 PM
I already had GZip running on my site (http://rk.md) since day one, but is there a recommended way to transition to the DEFLATE algorithm? I've tried adding the "SetEnv no-gzip dont-vary" to my .htaccess in addition to "SetOutputFilter DEFLATE", but upon checking my site's compression status via a third party site, no compression was detected. In other words, I successfully DISABLED Gzip but couldn't enable Deflate.

Am I missing something? :o

farcaster
02-14-2010, 04:22 PM
I can refer you to this blog post by Matt Heaton, CEO and I think Chief Techie at Bluehost on what he came up with concerning gzip. You can always access his blog column via the link on the main Bluehost home page.

http://www.mattheaton.com/?p=228

rishk789
02-15-2010, 06:53 AM
Thanks Farcaster! It's actually that post which initiated my original question about implementing mod_deflate. Matt didn't put up any instructions, and every HTML compression verification test I try does not return "deflate" as the compression I'm using (even when I've disabled GZip).

kevinjemes
07-07-2010, 01:21 PM
I have a large portal that receives on average 20,000 page views a day, the site was quite slow after active compression HTML, it was quite faster. hugs.

DavisSmith
07-09-2010, 02:19 PM
All modern browsers support gzip compression?
__________________
Tom

Yup most modern browsers support gzip. However, you may have trouble if people are using old browsers.