Banner
Increase Web Site Performance using PHP and GZIP
 

You can use PHP to return compressed content. Give your HTML file a .php extension and add this code to the top:
 

<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
 

If you are using Apache Web Server, there are also has two additional compression options:

  • mod_deflate is easier to set up and is standard.
  • mod_gzip is more powerful: you can pre-compress content.

Deflate is quick and works; use mod_gzip for more control. In either case, Apache checks if the browser sent the “Accept-encoding” header and returns the compressed or regular version of the file. However, some older browsers may have trouble and there are special directives you can add to correct this.

Bookmark and Share
Comments
Name
Date (desc)
Comment
 
 


No comments posted at this time



© 2024 - Blue Crown Software - (480) 306-6328 Register as New User Login