However, whether IIS or Apache by default only compressed HTML class static files, for PHP files need module configuration to support (iis7.5 in dynamic + static compression can also be), so the use of PHP itself to achieve gzip effect also become a reasonable demand.
The implementation of the method is very simple, open the PHP directory under the php.ini file,
Copy Code code as follows:
Zlib.output_compression = Off
; zlib.output_compression_level = -1output_buffering = Off
Modified into
Copy Code code as follows:
Zlib.output_compression =on
Zlib.output_compression_level = 5
Output_buffering = 4096
The following points need to be explained
The Zlib.output_handler must remain commented out because this parameter conflicts with the previous setting--an official claim.
Second, the general cache is 4k (output_buffering = 4096).
Third, the zlib.output_compression_level suggested that the parameter value is 1~5,6 above actual compression effect promotion is little, the CPU occupies is the geometrical growth.
Finally, the request headers and response headers are viewed through firebug, and the gzip effect has actually been displayed, or gzip is also displayed through the Webmaster gzip detection Tool.