Announcement

Collapse
No announcement yet.

Still don't understand how to implement gzip

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Still don't understand how to implement gzip

    I want to try out gzip-compression on some of my PHP-scripts. How can I do that?

    Currently I'm developing on Windows 2000 with latest Apache and latest PHP. My service provider runs Linux and PHP. Do I have to add code to my PHP-script or does the server handle the "gzipping" transparently? Do I have to do anything special to Apache? To PHP? If Apache need to be "altered" in some way, will the PHP-scripts still work if it isn't?

    I read somewhere that vBulletin 2 supports gzip-compression, so I guess there is need for gzip-code in my scripts as well.

    Please fill me in on what I should do. I would really love if someone took me through it step by step.

  • #2
    http://www.php.net/manual/en/html/ref.zlib.html
    Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

    PHP 4.0.6
    MySQL 3.23.39
    Windows 2000

    Comment


    • #3
      This is not what I meant. I'm talking about the transparent server-side compression of PHP-generated web pages. Apache gzips the web page and sends it to the browser that unzips it and displays it. I believe the vBulletin 2.0 demo is running it.

      Comment


      • #4
        No, that is what you meant

        Comment


        • #5
          He's probably talking about mod_gzip for Apache. See http://www.remotecommunications.com/apache/mod_gzip/

          This does not require any changes to html/php code.

          Of course, if he did mean mod_gzip then he's in the wrong forum.

          [Edited by fastforward on 01-23-2001 at 08:20 PM]
          http://britishexpats.com/ - British expatriate community

          Comment


          • #6
            I do mean the mod_gzip for Apache and I do believe that I am in the right forum. I wanted to know if there were any code-changes that had to be done. I read somewhere that vBulletin 2.0 supported this feature and I wondered why only vB 2 supported it if it didn't require any code changes.

            Comment


            • #7
              VB 2 uses what Ed was talking about. NOT mod_gzip.
              http://britishexpats.com/ - British expatriate community

              Comment


              • #8
                mod_gzip only works with static HTML.
                zLib works with dynamic PHP pages.

                Comment


                • #9
                  Originally posted by Ed Sullivan
                  mod_gzip only works with static HTML.
                  zLib works with dynamic PHP pages.
                  Actually the latest version of mod_gzip is *supposed* to work with PHP.

                  I say supposed because I have it installed and all it has done is break my image links. grr.

                  NEW mod_gzip v 1.3.14.6e - 12/04/00 that can compress both STATIC and DYNAMIC output for both external CGI and 'mod_xxxx' Apache module output is now available.
                  Matt
                  Sybase DBA / PHP fanatic
                  Sybase v. MySQL v. Oracle | Why I don't like MySQL | Download Sybase TODAY! | Visit DBForums.com!

                  Comment


                  • #10
                    Check your php.ini and do this:

                    output_handler = ob_gzhandler

                    It's working for me. It only does files that go through PHP, however.

                    Forward problems to /dev/null, please. This is working for me, YMMV.
                    http://racing.kos.net
                    http://www.rumour.com/

                    Comment


                    • #11
                      Ok, now I get it, but why would vBulletin benefit from being able to read and write to gzipped files?

                      Comment


                      • #12
                        No no no, it gzips the OUTPUT it sends to the browser, which is then unzipped by IE(/Netscape?) and displayed.

                        Comment


                        • #13
                          Oh, come on! Can't you guys leave a straight answer? Dennis Wrenn posted and gave me a link to the PHP manual and the "Zlib Compression Functions", but when I look at that page it only appears to be functions for reading and writing to gzipped files on the server. What am I missing here?

                          Do I need to make any additions to my current php code or is the gzipping completely transparent if I install zlib?

                          If zlib requires code additions, howcome mod_gzip doesn't?

                          The PHP 4.0.4 changelog sais "Added transparent gzip compression support.". What does that mean? That PHP now can read/write gzipped files on the server without any modules and stuff? That PHP can make use of zlib- or mod_gzip-compression of webserver output without any extra code?

                          "Note: The current CVS version 4.0.4-dev introduces a fopen-wrapper for .gz-files, so that you can use a special 'zlib:' URL to access compressed files transparently using the normal f*() file access functions if you prepend the filename or path with a 'zlib:' prefix when calling fopen().".
                          Am I the only one that doesn't quite get that?

                          [Edited by Rickard on 01-24-2001 at 09:54 PM]

                          Comment


                          • #14
                            Can't you guys leave a straight answer? Dennis Wrenn posted and gave me a link to the PHP manual and the "Zlib Compression Functions", but when I look at that page it only appears to be functions for reading and writing to gzipped files on the server. What am I missing here?
                            I'm staring at the code now, and yet what I say isn't a straight answer? Ooookkk...

                            You missed a function:
                            http://www.php.net/manual/en/html/fu...zcompress.html

                            Comment


                            • #15
                              Maybe I'm just really, really stupid, but I can't figure out what to do with gzcompress(). It deflates a string. Why would I want to do that?

                              The help sais "See gzencode() for gzip compression", but there is no such function declared in the help.

                              Please help me with this. I'm going out of my mind!!!

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X