简体   繁体   中英

Difference between mod_deflate and zlib output_compression

Can anyone tell me the difference between using mod_deflate and zlib output_compression?

I understand that zlib is done in PHP and mod_deflate is done in Apace, my .htaccess file looks like:

php_flag zlib.output_compression On

or:

SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|gif)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary

Advantages/disadvantages of either?

As far as I know they both compress the same amount as zlib.output_compression uses gzip, which is based on DEFLATE.

PHP's zlib output_compression will only work files passed through the PHP handler (ie .php files), but Apache's mod_deflate can work on any files (eg static CSS or JS).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM