Home > Backend Development > PHP Tutorial > How to enable Zlib (GZIP) compression optimization in php

How to enable Zlib (GZIP) compression optimization in php

WBOY
Release: 2016-07-25 08:58:49
Original
1011 people have browsed it
  1. zlib.output_compression = On
  2. zlib.output_compression_level = 6
Copy the code

After completion, you can check the result through the phpinfo() function, when the Local Value and MasterValue of zlib.output_compression are both On. , indicating that it has taken effect. The PHP pages visited at this time (including pseudo-static pages) have been GZIP compressed, and the compression effect is detected through Firebug or online web page GZIP compression detection tools.

If you need to use ob_gzhandler (default), you need to turn off zlib.output_compression and change the content of the php.ini file to:

  1. zlib.output_compression = Off
  2. zlib.output_compression_level = -1
Copy code

Note: ob_gzhandler is the recommended usage for most programs (discuz, phpwind, etc.), it is recommended that you use it.



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template