MoreSpeedWithGzipCompression
What is Gzip compression?Gzip compression reduces the HTML file size to 20-40%, thus keeping traffic low and in most cases even speeding up the time needed to display any of your folderblog pages (or any document in which you include gzip_compress.php.) Gzip compression does a server-side compression of the requested file and then sends the compressed package to browsers that support the functionality (very old browsers will just recieve normal files).
Server requirements
This is intended for cases only in which you do not have the Apache extension "mod_gzip" installed. In these cases, we are lucky that PHP has access to the same compression method; the only requirement is that you have the zlib library installed on your server, which is fairly standard. dstgsdtsdyg
If you want to test if gzip compression will work on your server, extract this zip file (1kb) to your server's root directory and call it from the browser by typing www.yourdomain.com/gzip_test.php. If it returns something (for instance, "gzip, deflate"), then Gzip is enabled on your server and you can proceed.
Instructions
Download the gzip_compress.zip (1kb) here.
folderblog 2.02 instructions:
Extract the zip file and upload gzip_compress.php to your folderblog 2.02 directory. Open your folderblog.php-file (which you may have renamed) in a text editor of your choice and change the first line from
<?phpinto
<?php include ('gzip_compress.php'); — that's it! folderblog 3 (beta) instructions:
Extract the zip file and upload gzip_compress.php to your folderblog 3 "extensions" directory — that's it!
[fb3 note: when using the gzip_compress.php together with the fb_mimetype.php you'll have to include the gzip_compress.php the way i described for folderblog 2.02. The reason for this is that the mimetype-switch could output the mime- and doctype before the gzip-compression tries to create the compressed server-side copy of all content what would lead to a mixture of compressed and uncompressed output what just isn't possible to understand for browsers...]
Update: If you want to use fb_mimetype.php alongside GZIP compression, you only need to change the very first line of fb.php from
<?phpto
<?php ob_start("ob_gzhandler");, as this function does all the required browser detection for you. This method will also work with all other versions of Folderblog, and you don't need to download anything or make any other changes. Confirm that it's working
With both versions of folderblog, you can easily test if Gzip compression is working: go to this site www.web-sniffer.net and enter the URL of any page on your folderblog. Click "submit" and look at the "Response Header" section. The entry for "Content-Encoding" should be "gzip", and below the table you will see the original and compressed transfer size for that specific page (as in this sample screenshot.)
If you are using Firefox and have the Web Developer extension installed you can merely open your site and click on "Information -> Show Response Header" to see your page's content encoding.
Update: Another, and perhaps better, way to test for GZIP compression is to use this site.
Last edited February 23, 2008 at 10:51pm.(edit this entry)