However, both iis and apache only compress HTML static files by default. PHP files require module configuration to support them (dynamic + static compression can also be enabled in iis7.5), so the effect of using PHP's own functions to achieve gzip has also become a a reasonable request.
The implementation method is very simple, open the php.ini file in the php directory,
Copy the code The code is as follows:
zlib.output_compression = Off
;zlib.output_compression_level = -1output_buffering = Off
Modify to
Copy code The code is as follows:
zlib.output_compression =On
zlib.output_compression_level = 5
output_buffering = 4096
Need explanation The following are the following points
1. ;zlib.output_handler must remain commented out because this parameter conflicts with the previous setting - the official statement.
2. Generally, the cache is 4k (output_buffering = 4096).
3. The recommended parameter value for zlib.output_compression_level is 1~5. Above 6, the actual compression effect will not improve much, but the CPU usage will increase geometrically.
Finally, check the request header and response header through firebug. In fact, the gzip effect has been displayed, or the webmaster's gzip detection tool also shows that gzip is effective.
http://www.bkjia.com/PHPjc/327580.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327580.htmlTechArticleHowever, both iis and apache only compress html static files by default. PHP files require module configuration to support them. (You can also enable dynamic + static compression in iis7.5), so use p...