PHP Compression - Speed up your pages!

What this wonderful script does, is compress your html and web pages every time it's loaded onto a browser. If it's not already obvious, you must be certain that you use PHP for your web pages and that your server supports it at least.

How to tell if it will work for my site

You need to check your server to be sure that the version of PHP installed on your sever is extended with the zlib module.

To do this, simply open Notepad and type the following:


Save the file as phpinfo.php and then upload it to your website. Visit the page you uploaded, and continue below:

Now we need to search for a specific module named zlib. Do this by pressing Control+F and search for zlib on the page. It will look similar to the image below:

zlib Compression

If you see something similar to the above box, you are ready to implement it into your site. If you do not see the above box, or one similar to it, please call your web hosting company and ask them if they can install it for you. (You can point them to this page so they know what you are trying to do)

How to implement it on my site

It is just as easy to implement it onto your website! Simply add the following code to the top of every PHP page you would like compressed, YES, it is that easy!

ob_start( 'ob_gzhandler' );
<title>My Compressed Page</title>
<p>This web page is now COMPRESSED!</p>

Copyright © Mr. Bob's Web Design, 2005. All Rights Reserved. Use of website and services are subject to the Terms & Conditions