开发者

Mod_gzip and php output bufferring redundant?

开发者 https://www.devze.com 2023-03-21 06:43 出处:网络
I\'m just learning ways to compress my website and i came upon two methods. One of them is apache\'s mod_gzip module and the other is php\'s output buffering, since they both compress files, would usi

I'm just learning ways to compress my website and i came upon two methods. One of them is apache's mod_gzip module and the other is php's output buffering, since they both compress files, would using both methods be redundant and unne开发者_如何学Ccessary? Or is there a distinction between the two methods i should know about?


Yes, the two methods are redundant to one another. Between the two, mod_gzip is generally easier to set up and more comprehensive -- as it's part of Apache, mod_gzip can compress content (like static HTML, Javascript, and CSS) which isn't served through PHP.


Note: PHP's output buffering doesn't necessarily compress output. But yes, if you have it configured to do so, then it and mod_gzip/mod_deflate are redundant. In most cases, I prefer to leave the compression to Apache, since it will also compress things that aren't run through PHP, like JS, CSS, XML, text, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消