Http Gzip Compression in PHP
GZIP compression saves as much as 70% of the size on a text-heavy webpage. What does this mean for your users? Faster loading websites and less latency. What does this mean for your server? Less load and less bandwidth will be used if you judiciously compress and cache.
In PHP, there are two easy ways to do this. The first is to add the following to your .htaccess file and let Apache do the rest:
php_flag zlib.output_compression on
php_value zlib.output_compression_level 2
The second is to add the following to the top of your php script file:
ob_start(”ob_gzhandler”);
Either way, you can check the results of your page online.
This entry was posted on Thursday, January 12th, 2006 at 10:54 pm and is tagged with output compression, compression level, gzip compression, script file, php script, htaccess, bandwidth, apache. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Add New Comment
Viewing 7 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)