Use php to determine if the server supports Gzip compression

  • 2020-09-16 07:25:26
  • OfStack

Gzip can compress the size of web pages to speed up the opening of web pages. 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 function.

Create a new file of type php, named test.php, and write the following code:
 
<?php phpinfo();?> 

Then save and upload it to the root directory of the space you want to test. After uploading, open URL in your browser:

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

After opening the page, CTRL+F looks for the following string:
_SERVER["HTTP_ACCEPT_ENCODING"]
If so, congratulations. Your space supports Gzip. If not, it means that your website cannot use Gzip compression.

Related articles: