Difference between mod_deflate and zlib.output_compression

Most of the Webmaster, Search Engine Optimization (SEO), Developers & Testers are concern about the overall website load time and may question about the compression from the server end. In this case, the compression can be achieved from both PHP's zlib output_compression extension and Apache's mod_gzip (old Apache version), mod_deflate module from server end.

But one question remains unanswered is that which compression method gives good compression and increases website overall load time. Today, we are going to find answer by comparing the two options with few details.

Apache's mod_gzip or mod_deflate moduleĀ  :

The mod_gzip or mod_deflate module is supported by Apache and provides compressed output from the server over the network to the end user which works on DEFLATE. It almost compresses all the files including the style sheets (CSS) and Java Script (JS). More about mod_deflate module can be found here.

<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon

PHP's zlib.output_compression extension :

The zlib.output_compression extension is supported by PHP and compresses only PHP handler pages hence proves less effective as it it will not compress non-PHP contents though it works on DEFLATE. More about zlib.output_compression extension can be found here.

zlib.output_compression On

Hence, we can say that the compression percentage achieved using Apache's mod_deflate module is good as compared to PHP's zlib output_compression considering the fact that zlib output_compression can compress only PHP handler contents.

Hope, the post helps to clear the doubts!

Abhijit Sandhan

Loves Open Source, Blogging, Traveling, Hiking and sharing Knowledge!

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button