logic_earth : any reason why I should remove the “<?xml version=“1.0” encoding=“UTF-8”?>” ? I just copied it from website design books and I understand it sets the carachter encoding, right? it’s not necessary to include it?
HTML pages should use a HTML doctype, not the XML opening tag. You can set them to UTF-8 with a meta tag, and save the files as UTF-8 from your editor.
The “<?xml version=“1.0” encoding=“UTF-8”?>” will trigger what is known as “Quirks Mode” in some (all?) browsers. You want “Standards Mode” and, to get that, you need a DOCTYPE.
You can compress your site in php aplication with deflat or gz-ip (recomend). Your HTML data will reduced and speed up. If you compress meybe you need to check if user-agent support this method and which one.
Doing it via PHP is incredibly slow, not to mention you would have to run every piece of CSS, HTML, JavaScript through PHP. On a shared server this setup can get you in trouble pretty quickly. In fact using output compression on a shared server in any form can get you in trouble. A lot more resources (CPU, RAM, etc) are required to implement compression. Over using those resources (on a shared server) will not go over well with the hosting company.
Either way, doing the compression though PHP, you pretty much lose the point of compressing. While it will download faster, the processing time required to compress offsets that faster download. Requiring the user to wait longer before the download even starts.
Old browser doesn’t support get data compresed like IE 6 and if you set this in your application make one if which check if browser support or doesnt support compression. You can check with If “Accept-Encoding” has “gzip” or and “deflate”.
Do you have some benchmarks to show the difference between compresisng using PHP or compressing using the web server (e.g. mod_deflate)? Again, just out of curiosity, I always enjoy reading about performance related stuff
As for benefits and downsides, I guess it has to do with which is more expensive: bandwidth or processing power. I have no idea about that though.
My personal favourite way of handling this kind of stuff is to compress using either PHP or mod_deflate, but also sending headers for the correct caching of the resources in the browser (i.e. an image that never changes, browser-cache it for a month or even a year).