Bad Credit Mortgages - Web Advertising - Mortgages - Mortgage Calculator - Teen Chat

PDA

View Full Version : mod_gzip for PHP only


digitalpoint
Mar 6th 2004, 7:32 pm
I was poking around with mod_gzip today to see about adding it to my apache servers. For those of you that don't know, it will compress HTML (or any document within an HTTP request) on the fly, send it to the user, and the user's browser will decompress it. Saves bandwidth and makes load times faster for users, as text/HTML documents typically compress down 8x. The bad thing about it is it puts a load on the web server CPU to compress everything going out. So instead of writing a bunch of rules for it on what to compress (it's pretty useless to compress images since they are pretty compressed already). I found that PHP itself has the ability to turn on gzip compression for PHP documents only. Which is nice, because all my really big documents are generated with PHP. PHP is also smart enough that it will not compress images (even if generated with PHP).

So just a tip... if you want to compress your outgoing PHP files, add this to your php.ini file:

zlib.output_compression On

That of course assumes you have zlib support compiled into your PHP install, but most PHP installations do.

The main reason for it was some keyword tracker users have 1,000+ keywords in their account, and the keyword list screen was spitting out over 1MB of HTML to view it. So now it brought it down to about 120k for those users.

- Shawn

nlopes
Mar 14th 2004, 5:15 am
You can also add this to the .htaccess file:

php_value zlib.output_compression 1
php_value zlib.output_compression_level 3


the compression level should be set to 3 because is the optimal relation for speed/bandwidth. It reduces the bandwith almost as level 9, but reduces drastically the cpu usage.

digitalpoint
Mar 14th 2004, 9:49 am
Well, I would say the optimal compression level is dependent on your server and available bandwidth. For example, we have lots of bandwidth, but the servers are under high load, so we just run it at level 1.

- Shawn

onlineshopping
Jun 2nd 2008, 1:21 pm
Well, I would say the optimal compression level is dependent on your server and available bandwidth. For example, we have lots of bandwidth, but the servers are under high load, so we just run it at level 1.

- Shawn

As what i faced this problems with Godaddy's, i do have unlimited deluxe plan still not get good benefits of using it.

bryanw
Aug 4th 2008, 8:03 pm
I followed this tutor, but failed to add gzip_mod with godaddy dedicated server.
http://www.bluestream.org/Networking/gzip.htm

It says "mod_gzip.so: undefined symbol: top_module"

Can't work it out.

As what i faced this problems with Godaddy's, i do have unlimited deluxe plan still not get good benefits of using it.

killer2021
Nov 11th 2008, 6:04 pm
Well, I would say the optimal compression level is dependent on your server and available bandwidth. For example, we have lots of bandwidth, but the servers are under high load, so we just run it at level 1.

- Shawn

The key here is to have lots of bandwidth. My host personally has limited bandwith so I set it differently.