Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've edited my php.ini file so that it has these two entries:

zlib.output_compression = On
zlib.output_compression_level = 4

However, after restarting apache, when I request php pages, the headers returned in the response indicate that my server is still NOT serving compressed pages (here are selected headers as viewed using Chrome's Network feature):

Cache-Control:no-cache, must-revalidate, max-age=0
Content-Type:text/html; charset=UTF-8
Date:Mon, 17 Sep 2012 23:46:13 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified:Mon, 17 Sep 2012 23:46:13 GMT
Server:Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/ PHP/5.2.17
Via:1.1 XXX-PRXY-07

What might I be doing wrong? Is there any other setting that I need to change?


Here is another set of headers returned to another computer:

Cache-Control:no-cache, must-revalidate, max-age=0
Content-Type:text/html; charset=UTF-8
Date:Thu, 20 Sep 2012 09:45:26 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified:Thu, 20 Sep 2012 09:45:26 GMT
Server:Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/ PHP/5.2.17
share|improve this question
What is your goal exactly? Typically, you would disable zlib in PHP and have Apache use mod_deflate to return the resultant HTML in a gzipped format. – Ben Lessani - Sonassi Sep 21 '12 at 8:52
up vote 2 down vote accepted

It looks like the traffic is being proxied. Verify the proxy can handle compressed traffic and isn't decompressing it for some reason.

If the client (the proxy in this case, but in many cases the end user's browser) doesn't support the compression in use, traffic will not be compressed.

I also notice that neither mod_zlib or mod_deflate seem to be loaded. You may need to check that the module is working and configured (you might have to add a define option to apache startup, or enable a config file).

share|improve this answer
Hi, thanks for answering. I don't think that the proxy is the issue here: I tried accessing the site from another computer that wasn't sitting behind a proxy, and I'm still getting uncompressed data in response. I've edited my original response to show the headers returned to this second computer. – Tola Odejayi Sep 20 '12 at 9:47
Hi Falcon Momot. Your edit put me on the right track; I did have mod_deflate installed, but it wasn't configured to be used in apache. Thanks - you deserve your 50 points! – Tola Odejayi Sep 24 '12 at 17:44

Either your php.ini file is not being read or your zlib module isn't loaded. Also make sure that output_handler is not set. If you need to use an output handler with gzipped output, use zlib.output_handler instead.

The first thing to do is ensure that PHP knows about zlib and your configuration changes. Create a file called test.php and put the following in it.

<?php phpinfo(); ?>

Now access that page with your browser. What does the table for the zlib section say? It should look like this and, if it does, your page should be served with gzip content-encoding. If you don't see a zlib section then you may need to add a directive in php.ini to load the module.

Screen capture of phpinfo() zlib details

Also check the Core section of the page to make sure that output_handler is set to no value.

Screen capture of phpinfo() output_handler details

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.