My website is programmed in PHP and currently uses HTTP compression (gzip) using PHP's built-in compression functions. (I cannot use mod_deflate.c because my shared hosting provider will not install it because it would use a lot of CPU.) The shared server where my website is hosted currently hosts 100 other websites. I have programmed the html and css quite efficiently and there is not much room to rewrite the same thing with less markup. My images are already compressed.

My question is whether using PHP's compression actually is faster for the user than sending it uncompressed.
1. The CPU compresses the output, sends the output to the browser and the browser has to decompress it. (Compression functions use considerable CPU on both computers.)
2. Send the output uncompressed. (Saves CPU but sends more data.)

Is it worth it to compress my webpages if each consist of 20kb of html/css and 30kb of images?

well its a choice either bandwidth or ram usage .

make yourself a page
a really enormous wad of text
images are insignificant as jpg and png are already optimized and nobody should be bmp-ing
make 2
one with gzip enabled, one without
compare load times
run both through http://www.websiteoptimization.com/services/analyze/ to see the difference
I find a huge speed differential in favoour of

<?php ob_start("ob_gzhandler"); 
ob_flush(); ?>

css and javascripts respond well to gzip,
example: in the include file creates your <head>
change references to 'style.css' to 'style.css.php'

<?php header ('content-type:text/css'); 
ob_start("ob_gzhandler"); ?>/*<style>*/
.rss-box { margin:1em 3%; padding:4px 8px; background-color:#ededed; border:2px dashed #7485CA; }
.rss-title, rss-title a { font-family:"American Typewriter", "Trebuchet MS", Trebuchet, Lucida, sans-serif; font-size:100%; font-weight:bold; margin:5px 0; padding:0; letter-spacing:1px; }
/* bla bla bla */
<?php ob_flush(); ?>

likewise script.js can be script.js.php with content-type:text/javascript and gzip enabled

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.