1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

mod_gzip for PHP only

Discussion in 'Site & Server Administration' started by digitalpoint, Mar 6, 2004.

  1. #1
    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
     
    digitalpoint, Mar 6, 2004 IP
  2. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can also add this to the .htaccess file:
    
    php_value zlib.output_compression 1
    php_value zlib.output_compression_level 3
    
    Code (markup):
    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.
     
    nlopes, Mar 14, 2004 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    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
     
    digitalpoint, Mar 14, 2004 IP
  4. onlineshopping

    onlineshopping Banned

    Messages:
    160
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As what i faced this problems with Godaddy's, i do have unlimited deluxe plan still not get good benefits of using it.
     
    onlineshopping, Jun 2, 2008 IP
  5. bryanw

    bryanw Peon

    Messages:
    197
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.

     
    bryanw, Aug 4, 2008 IP
  6. killer2021

    killer2021 Peon

    Messages:
    872
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The key here is to have lots of bandwidth. My host personally has limited bandwith so I set it differently.
     
    killer2021, Nov 11, 2008 IP
  7. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #7
    Does mod gzip work for most mobile browsers users?
     
    xrvel, Jun 14, 2009 IP