This article illustrates how PHP implements the Gzip configuration method in the Apache environment. Share to everyone for your reference. Specifically as follows:
1, conf/httpd.conf
1) Remove the #loadmodule headers_module modules/mod_headers.so in front of the note #,
2) Add LoadModule deflate_module modules/mod_deflate.so,
3 Remove #include conf/extra/httpd-vhosts.conf before the comment #.
2, conf/extra/httpd-vhosts.conf
Add in VirtualHost
<location "/" >
setoutputfilter DEFLATE
browsermatch ^mozilla/4 gzip-only-text/html browsermatch
^ mozilla/4\.0[678] No-gzip
browsermatch \bmsie!no-gzip!gzip-only-text/html setenvifnocase Request_URI
\. (?: Gif|jpe?g|png) $ no-gzip dont-vary
Header append vary user-agent env=!dont-vary
</Location>
For example:
<virtualhost *:80>
documentroot "d:/apache2.2/htdocs/wef"
<location "/" >
setoutputfilter DEFLATE
browsermatch ^mozilla/4 gzip-only-text/html
browsermatch ^mozilla/4\.0[678] No-gzip
Browsermatch \bmsie!no-gzip!gzip-only-text/html
setenvifnocase Request_uri. (?: gif|jpe?g|png) $ no-gzip Dont-vary
Header append vary user-agent env=!dont-vary
</Location>
</VirtualHost>
I hope this article will help you with your PHP program design.