Use php to determine whether the server supports Gzip compression

Source: Internet
Author: User
To enable Gzip, you need to support the server. here, we simply use php to determine whether the server supports the Gzip function. The details are as follows, if you are interested, you can refer to Gzip to compress the webpage size to accelerate the speed of opening the webpage. Currently, almost all mainstream browsers support this function, but enabling Gzip requires server support, here we simply use php to determine whether the server supports Gzip.

Create a new php file named test. php. write the following code into the file:
The code is as follows:


Save and upload the file to the root directory of the space you want to test. after the file is uploaded, open the URL of the file in the browser:

Http: // your domain name and directory/test. php, such as this site is: http://3aj.cn/test.php

After the page is opened, CTRL + F looks for the following strings:
_ SERVER ["HTTP_ACCEPT_ENCODING"]
Check whether the gzip parameter is available later. if so, congratulations, your space supports Gzip. if not, sorry. This means that your website cannot be compressed using Gzip.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.