It's possible that mod_deflate has been configured incorrectly.
A typical mod_deflate configuration may be excluding certain browsers based on user-agent strings, and may only be configured to compress certain file types - identified by their MIME type as registered on the server.
You should be compressing all of your HTML, CSS and Javascript files, but not your PNG, GIF or JPEG files, and there are bugs with Netscape 4 you may or may not want to account for. Try using the sample code from the documentation:
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
Note too that the GIDZipTest GZIP test you posted does not test associated Javascript and CSS files, whereas YSlow does - in GIDZipTest GZIP test you'd need to test these individually.
I guess it is also possible that your ISP is using a caching proxy - transparent or not - which is mangling or removing your Accept-Encoding: header. To rule this out as the cause you could get someone to test it from outside of your ISP.
Another thing to note is that when compressing files using gzip you are trading bandwidth for CPU time. Above the lower compression strengths you will see diminishing returns in bandwidth savings, but huge increases in CPU time required. Unfortunately with a compression strength as high as 9, you are almost certainly wasting too much CPU time for very little improved compression - I would always recommend using strength of 1.
That's not really the answer you might expect, but did you try not compressing out data with PHP, but with Apache ?
This can be done use mod_deflate
.
Couple of things :
- it would mean less calculations for PHP
- it would also mean (and that's the nicest part ;-) ) that your CSS/JS files could be compresses to ; considering the size of those, nowadays, it might not be a bad thing to compress them...
As a sidenote : to help us figure out what's going wrong with the compression by PHP, could you give more informations ? Like the URL of your site (if it's public), and some code ?
EDIT now that we have the URL : http://ego.pestaa.hu/
When I go to that page, the response's headers are as follow :
HTTP/1.x 200 OK
Date: Sat, 01 Aug 2009 21:53:37 GMT
Server: Apache
X-Powered-By: PHP/5.2.6
**Content-Encoding: gzip**
Vary: Accept-Encoding
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
(using firefox 3.5 with LiveHTTPHeaders extension)
The three testing sites you indicated also say that your page is gzipped.
Did you find what the problem was ?
Are you sure this is not something coming from your browser, that would not send the following header in the request :
Accept-Encoding: gzip,deflate
EDIT after other answer
Quote from the comments :
the source of problem probably isn't
my website but my isp/browser/router.
One of them may decompress every
component before it reaches internal
processes.
Oh, if the problem is not your website, I think I totally mis-understood the question -- sorry about that :-( I thought you didn't know how to server gzipped content from your website.
And I think I'm not the only one, btw
If the problem has nothing to do with your website's configuration, then, two possibilities :
- maybe a mis-configuration of firefox ? If you go to
about:config
, what does the network.http.accept-encoding
say ? For me, it's gzip,deflate
- if the problem is coming from your ISP or something like that, there's nothing anyone can do...
Best Answer
mod_gzip
is an obsolete part of Apache 1.x, having been replaced bymod_deflate
in Apache 2.This
mod_deflate
configuration makes YSlow happy here:The only reason there are two
AddOutputFilterByType
lines is to avoid horizontal scrolling.