Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 10 of 10

This is a discussion on mod-gzip - Does Jaguar Have it? in the Shared & Semi-Dedicated forum
Is Jaguar not using mod-gzip for apache? From what i've read it can generally compress html by 75% and most (99% or so) browsers support ...

  1. #1
    Loyal Client
    Join Date
    Jan 2005
    Posts
    159

    mod-gzip - Does Jaguar Have it?

    Is Jaguar not using mod-gzip for apache?

    From what i've read it can generally compress html by 75% and most (99% or so) browsers support it.

    The only downside is that compressing is a very small burden on the CPU - which might explain why they wouldn't use it.

    At least I'd like to gzip my homepage - which I'm converting from dynamic to static (or to be static 95% of the time).

    -------------

    If I'm generating my files in php is there a second (php-only) way to do compression with gzip, without having mod-gzip enabled?
    (I think there is.)

    Aaron

  2. #2
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Um...

    Every server I've been on, at JagPC, has GZ -- although I use BZ2 most of the time, which is GZ on crack!

    Are you sure it's not installed on your machine?
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  3. #3
    Loyal Client
    Join Date
    Jan 2005
    Posts
    159
    What do I need to activiate it? I thought it would be running automatically, but it isn't.

    Do I need to add a header field to my html that says:
    "Content-Encoding: gzip"

  4. #4
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Oops! Sorry!

    I was thinking about gzip file compression.

    zlib and gzip and often interchangeable in discussions.

    So, you want to implement HTTP compression, right?

    zlib is available...
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  5. #5
    Loyal Client
    Join Date
    Jan 2005
    Posts
    159
    In php you can add the following first line to your code:
    ob_start("ob_gzhandler");

    Note it has to be the first executable statement in your php code.

    I'm still not sure how to do it with html.

  6. #6
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562
    mod_gzip isn't the exact same thing as compressing from inside php. Compression at the Apache level should be faster (less machine load for same result), although the differences will in most cases probably be small.

    You can see whether it's installed on your server by looking at a phpinfo() output under Apache, Loaded Modules. To work reliably it must not only be there, but it must be the last module loaded. (This manual page explains why that position matters.)

    I've asked support to install it for me some years ago (on the server I was on then), which they were quick to do. However, it didn't stay last in the list for long, as apparently the (other) support staff working on the machine wasn't aware of that need. So, if you're going to rely on mod_gzip compression, you'll want to keep an eye on that.

    Once the module is loaded, you can activate and configure it for your site via directives in your .htaccess. You can for example tell it to start a chache of already compressed files, skip files that are too tiny to bother with and only compress file types on which it is usefull. It for example makes a huge difference on large html files, but is not worth the trouble at all on a gif file, as that's already a highly compressed format.

    I was (and still am) using the compression mainly to bring a few large pages down to a size acceptable for modem users. It's PHP output that changes often and sees relatively few page views each month, so I settled for the PHP-side compression akreider2 mentioned.
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  7. #7
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Quote Originally Posted by akreider2 View Post
    In php you can add the following first line to your code:
    ob_start("ob_gzhandler");

    Note it has to be the first executable statement in your php code.

    I'm still not sure how to do it with html.
    Well, this is how I start it...

    Code:
    if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')){
            if (extension_loaded('zlib')){
                $do_gzip_compress = TRUE;
                ob_start();
                ob_implicit_flush(0);
                }
    And, this is how I stop it...

    Code:
    $contents = ob_get_contents();
    ob_end_clean();
    echo replace_for_mod_rewrite($contents);
    die();
    Does it work? http://www.pipeboost.com/GetReport.a...ww.lenon .com
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  8. #8
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    OH, DUH!!!

    I was just fiddling around with some GZIP checkers -- testing my site -- and one of them linked to this:

    Source: http://www.whatsmyip.org/forum/viewtopic.php?t=43

    How to verify its working:
    gzip works so seamlessly, no doubt you'll be wondering, "is it working?" Here's the easiest way to check, and you can use it on any web page. Load the page in FireFox. Now in the 'Tools' menu, choose 'Page Info'. Now in the window, you will see a size value. That is the actual size of the html of the page as it was transmitted over the internet.
    LoL! Learn something new every day!

    I use FX's 'View Page Info' all the time, and never noticed that before...

    My home page, compressed, is only about twice the size of this page!
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  9. #9
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562
    Gzip checkers? Hmm.. that sounds way over the top! Then comparing the size of the page saved-to-disk with the size that page info gives is indeed a lot simpler.

    However, taking a peak at the HTTP headers of the page you get in is even simpler than that. [I do presume pretty much any decent developer has the plug-ins for that installed in his browser, right?] If it's gzipped, there's a header:
    Code:
    Content-Encoding: gzip
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  10. #10
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Quote Originally Posted by Gwaihir View Post
    Gzip checkers? Hmm.. that sounds way over the top!
    Yeah, long story (short version)...

    I'm one of the first ppl that got gzip compression working with PHP-Nuke -- if not The First. I showed others how to do it, and they were always amazed by the instant difference in speed, et cetera; however, there was always some hot-shot that claimed it had been tried many times, before I came along, and it was impossible.

    So, I would offer the results of various gzip checkers as proof. Then, these detractors would claim that the gzip checkers lied -- that the gzip checkers were just seeing the header and 'guesstimating' the compressed size, yada, yada, yada.

    Anyway, that was a few years ago, so I was curious to see how these checkers looked nowadays...
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •