GZIP output support on CPanel31 w. PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samsam
    Member
    • Mar 2004
    • 79

    GZIP output support on CPanel31 w. PHP

    Hi.

    Nice to be back on the forums. Hopefully everyone hasn't drifted away...

    I have a PHP-based site on cpanel31 that would benefit from gzip output support - ie compressed HTML output.

    It has a setting to enable it, so I have, but upon testing it appears as if the output is not actually being compressed.

    In exploring the server settings to see what might be the issues here, I had a look at phpinfo for cpanel31.

    It reports that Zlib support is there, but that zlib output compression is Off:

    ZLib Support enabled
    Compiled Version 1.1.4
    Linked Version 1.1.4

    Directive Local Value Master Value
    zlib.output_compression Off Off
    zlib.output_compression_level -1 -1
    zlib.output_handler no value no value

    Now, how can I alter this output compression setting, so that my php app can actually do output compression?

    AFAIK, I can't edit php.ini to turn this on, but are there other ways to get this support enabled within PHP?

    I know I can make a .htaccess change to enable GZIP output compression using Apache's mod_gzip, which (I think) is available on Dathorn Apache, along the lines of:

    mod_gzip_on Yes

    But it would be nice to let this be enabled within PHP.

    Any advice?

    samsam
  • samsam
    Member
    • Mar 2004
    • 79

    #2
    Don't worry about it....

    Don't worry about it - it looks as if GZIP support DOES actually work.

    One of the sites I was checking it with - the normally excellent:

    Web Page Analyzer – 0.98 – from Website Optimization Free Website Performance Tool and Web Page Speed Analysis Try our free web site speed test to improve website performance. Enter a URL below to calculate page size, composition, and download time. The script calculates the size of individual elements and sums up each type of ... Read more


    in-correctly reported GZIP as not enabled.

    However a dedicated GZIP reporting site:



    confirmed that GZIP support was there and working fine.

    Further scrutiny of the HTTP headers returned by the site also confirms it is working.

    NFA required.

    cheers

    SamSam

    Comment

    • mdmcginn
      Junior Member
      • Mar 2004
      • 22

      #3
      mod_gzip in htaccess?

      How do we put mod_gzip in htaccess, to speed up the whole site? This code didn't do it.

      Code:
      <IfModule mod_gzip.c>
      mod_gzip_on yes
      </IfModule>
      But this code worked, when I put it in each file:

      Code:
      <?php
      ob_start( 'ob_gzhandler' );
      ?>

      Comment

      • mdmcginn
        Junior Member
        • Mar 2004
        • 22

        #4
        Here's the answer to my question. I put these lines in php.ini and now all my pages are gzipped:

        Code:
        zlib.output_compression =ON;
        zlib.output_compression_level = 1;

        Comment

        • djn
          Senior Member
          • Mar 2004
          • 140

          #5
          I'm not sure about cpanel31, but I can tell that cpanel17 works fine with this:

          <IfModule mod_gzip.c>
          mod_gzip_item_include mime ^text/html
          mod_gzip_item_include mime ^application/xhtml\+xml
          mod_gzip_item_include mime ^text/css
          mod_gzip_item_include mime ^text/javascript
          </IfModule>

          Comment

          • ZYV
            Senior Member
            • Sep 2005
            • 315

            #6
            samsam, instead of using some questionable third-parety services to check for GZip output compression you can figure it out yourself from the console:

            # wget http://lic40.zaytsev.net/ipb/index.php?showforum=5
            Connecting to lic40.zaytsev.net[***.190.183.90]:80
            index.php?showforum= 100% |************************************************* ********************************| 53 620 bytes 00:00 ETA
            # wget --header="Accept-Encoding: gzip,*" http://lic40.zaytsev.net/ipb/index.php?showforum=5
            Connecting to lic40.zaytsev.net[***.190.183.90]:80
            index.php?showforum= 100% |************************************************* ********************************| 9 221 bytes --:-- ETA
            P.S. Actually this site is not hosted on the Dathorn's servers.

            Comment

            Working...