In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces php how to open gzip compression method, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Generally speaking, when gzip compression is enabled, the volume of a page file can be reduced by 60% to 90%. For text sites, it can save a lot of bandwidth and user waiting time. However, both iis and apache only compress html static files by default, and module configuration is needed to support php files (dynamic + static compression can also be enabled in iis7.5), so it is reasonable to use the function of php to achieve the effect of gzip.
The online tutorial is basically that you copy me and I copy him, which is nothing more than adding head and tail or self-construction function. In fact, every php page has to add code-of course, it can also be referenced by include, but it is always a little troublesome.
In fact, the easiest way is to open the php.ini file in the php directory, find zlib.output_compression = Off, and change it to zlib.output_compression = On.
Then take out the-1 in front of the zlib.output_compression_level and change the-1 to the value of 1-5. This makes it possible to achieve the gzip effect of all php pages, eliminating the need to modify the site's php files separately-saving a lot of time if there are many sites.
What needs to be explained is the following points
1. Zlib.output_handler must remain commented out because this parameter conflicts with the previous setting-officially.
Second, in general, the cache is 4k (output_buffering = 4096).
3. Zlib.output_compression_level suggests that the parameter value is 1: 5. 6. The actual compression effect does not improve much, but the cpu occupancy increases geometrically.
Figure 1. Check the request header and response header through firebug. In fact, the gzip effect has been shown.
Figure 2. The gzip detection tool of the stationmaster station also shows that gzip is valid.
Thank you for reading this article carefully. I hope the article "how to turn on gzip compression method in php" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.