Mod_gzip and/or PHP zlib compression


#1

I would like to take advantage of Apache’s mod_gzip functionality, but I can’t seem to configure it here on Dreamhost. I had it working at my last host with the following in my .htaccess:

<FilesMatch “.(php|html?)$”>
php_value zlib.output_compression 4096
php_flag zlib.output_compression "On"
php_flag zlib.output_compression_level 1

This doesn’t work. I also tried adding this, based on a forum search here:

mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude mime ^application/pdf$

This also didn’t make it happen. This is on PHP4 as CGI. Can anyone provide guidance as to how to make this work?


#2

We automatically set up mod_gzip on all domains so you don’t have to do anything.

  • Dallas
  • DreamHost Head Honcho/Founder

#3

Not to be rude, but I don’t think that’s the case. I sniffed web traffic from my domains and it’s all plain text, no gzip compression. I also used this online gzip checker:

http://www.whatsmyip.org/mod_gzip_test/

And it confirms that my domains weren’t/aren’t gzipped. Here are a couple threads where other users have discovered the same thing:

http://discussion.dreamhost.com/showthreaded.pl?Cat=&Board=forum_troubleshooting&Number=32768

http://discussion.dreamhost.com/showthreaded.pl?Cat=&Board=forum_beginners&Number=33195

So, apparently I’m not alone in thinking there’s something up with the gzip functionality. :expressionless:


#4

Ah, you were correct! I just tested mod_gzip the other day and somehow determined it was working but I wasn’t able to determine that again just now so I must have confused myself along the way somewhere before.

Anyway, I have fixed it and it is working for your domains now (I’m assuming your web id is the same as your login here on the discussion boards). Note that there is a minimum file size required before it will compress so it won’t work on very small files (like the index.html on one of your domains).

Note that the whatismyip.org mod_gzip test does not work for testing our servers. I don’t know why, but I do know that it still gives a negative response when mod_gzip is working.

I’m using this simple script to test:
http://www.neuro-tech.net/archives/000031.html

If you’re still having problems with a specific domain or URL you can send me a private message with the specifics and I’ll take a look.

  • Dallas
  • DreamHost Head Honcho/Founder

#5

I have fixed it and it is working for your domains now

Is this going to be enabled for everyone by default?


If you want useful replies, ask smart questions.


#6

Yeah, it’s now our default configuration but it may take a few days for the new configuration to roll out to all of our websites. I can push it through for your website right away if you have urgent need for the gzipping to work right away.

The problem was the order in which our apache modules were loading. mod_gzip needs to be listed in the apache config after mod_mime and it wasn’t.

I also updated our configuration it to work with FastCGI while I was tinkering.

  • Dallas
  • DreamHost Head Honcho/Founder

#7

Dallas,

I verified with packet capture that my domains are now sending content with gzip encoding.

Thanks so much for your prompt attention to this issue.


#8

it’s now our default configuration but it may take a few days for the new configuration to roll out to all of our websites. I can push it through for your website right away if you have urgent need for the gzipping to work right away.

No, it’s no rush for me, I was just curious. But thanks!


If you want useful replies, ask smart questions.


#9

Is there a way to disable mod_gzip for particular files/directories?

There are some situations where mod_gzip doesn’t quite work right. For example, some PHP scripts really do need to be in Transfer-encoding: Chunked in order for you to be able to tell that they haven’t just locked up.

I tried adding ‘mod_gzip_on No’ to my .htaccess file and it has no effect.


#10

If putting that in .htaccess doesn’t work then it’d probably have to be something we do for you. We can very easily turn it on and off on a per domain basis so you can set up a subdomain that you want it off for and ask us to turn it off. That would probably be the easiest setup for us to maintain and for you to use.

  • Dallas
  • DreamHost Head Honcho/Founder