We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    Quote from: Cassiel at Jul 31, 2007, 11:21 AM

    If you do what pixelchutes said on Reply #4 you’ll get your php-generated pages gzipped.

    I guess one benefit to the other approach would be you could use it on IIS where .htaccess is not an option? Or, if you can’t modify your php.ini?

    However, if in Apache and you have the required modules, it would seem a bit easier to enable without introducing any more overhead to the DocParser.
      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 4707
      • 73 Posts
      Quote from: pixelchutes at Jul 31, 2007, 11:26 AM

      However, if in Apache and you have the required modules, it would seem a bit easier to enable without introducing any more overhead to the DocParser.

      Indeed, if you have mod_gzip or mod_deflate in apache you could gzip all the content served, including css and js files. No need to be done by PHP. No idea how to do that in IIS though.
        • 23491 ☆ A M B ☆
        • 1,056 Posts
        Quote from: pixelchutes at Jul 30, 2007, 02:28 PM

        Quote from: sirlancelot at Jul 30, 2007, 12:48 PM

        gzcompress() PHP Documentation

        Cool. What is the primary difference/benefits opposed to using .htaccess? Never used gzcompress() function myself...

        # For servers that support output compression, you should pick up a bit of
        # speed but un-commenting the following lines.
        
        php_flag zlib.output_compression On
        php_value zlib.output_compression_level 5
        


        I’ve written a rather cool module/plugin/snippet suite for associating external documents (PDF, DOC, XLS, MP3, ZIP, etc) to ANY given MODx document, all with Manager and Web User Permissions out of the box. I hope to prepare a release for community review in the near future.

        Now, that said, I was reviewing this thread http://modxcms.com/forums/index.php/topic,16598.msg105683.html#msg105683 regarding Download scripts and mod_gzip interference...After a quick round of testing I quickly found that the download time of my larger documents was DRAMATICALLY INCREASED by disabling the output compression. I hadn’t realized until now that it was interfering.

        In the thread, Jason discusses how to do disable compression using a custom .htaccess file in the same directory as your download script. However, because I use MODx for my download handling (the key behind the secure downloading) I don’t have this option, as it would disable compression for the entire site, not just downloads.

        It appeared that keeping mod_gzip enabled was no longer going to be an option...until I recalled this thread!

        If my thinking is correct, I should be able to disable GZip compression in .htaccess (speeding up my downloads/preventing potential errors) but also leverage
        gzcompress()
        (+ MODx plugin) to compress only my HTML.

        Unfortunately, I wouldn’t obtain the benefit of GZip on my static .JS/.CSS files, unless anyone can think of a way to conditionally turn off mod_gzip based on the HTTP request smiley
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.
          • 4707
          • 73 Posts
          From what I can imply here, you should be able to set only the .css and .js files for compression using some parameters in mod_gzip.

          There is also a way to compress CSS and JS with PHP. Not so clean as the first one though.
            • 27376
            • 576 Posts
            Quote from: pixelchutes at Jul 31, 2007, 06:53 PM

            Unfortunately, I wouldn’t obtain the benefit of GZip on my static .JS/.CSS files, unless anyone can think of a way to conditionally turn off mod_gzip based on the HTTP request smiley
            Example Configuration for mod_gzip

            Look towards the bottom for filters.
              • 23491 ☆ A M B ☆
              • 1,056 Posts
              Quote from: sirlancelot at Aug 01, 2007, 10:48 AM

              Example Configuration for mod_gzip

              Look towards the bottom for filters.

              Awesome stuff!! I’ll have to play with it and then reply with my results. Thanks!
                Mike Reid - www.pixelchutes.com
                MODx Ambassador / Contributor
                [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                ________________________________
                Where every pixel matters.
                • 42618
                • 3 Posts
                Hi All,

                I followed the instructions in this link just now, which involves adding code to the .htaccess to enable Gzip compression on the server: http://salscode.com/web-resources/gzip-htaccess

                Seems to work ok. I haven't noticed any issues although I haven't noticed a visible difference in speed either. However, it is being noticed by the Page Speed https://developers.google.com/speed/docs/best-practices/payload#GzipCompression add-on for Firefox Firebug.

                I tried uncommenting
                #php_flag zlib.output_compression On
                #php_value zlib.output_compression_level 5
                but it caused an Internal Server 500 error on the entire site, so I quickly commented out those lines again.