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.
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.
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!