PHP: no output on the Gzip page

Source: Internet
Author: User
PHP: no output on the Gzip page

  1. Output_buffering = Off
  2. Output_handler =
  3. Zlib. output_compression = On

You can enable gzip acceleration for all site php files.

For html files, you can configure the. htaccess file and use php to process html requests (this will increase the server load, and gzip processing on nginx or apache is recommended ):

  1. AddHandler x-httpd-php. html. htm

Problem: PHP5.3 is installed by default. Once the Gzip compression output function is enabled, the homepage of the website cannot be displayed. This is caused by PHP configuration problems. The default 5.3 configuration is as follows: output_buffering = 4096; set it to off or 0.

After verification, this problem exists in PHP 5.1-PHP5.2.

You do not have to worry about whether compression is affected or not. you can use the following method to determine whether compression is affected:

  1. Curl-I -- compressed http://bbs.it-home.org

HTTP/1.1 200 OKServer: nginx/0.8.13Date: Tue, 01 Sep 2009 16:38:53 GMTContent-Type: text/htmlConnection: keep-aliveVary: Accept-EncodingX-Powered-By: PHP/5.2.10Expires: mon, 26 Jul 1997 05:00:00 GMTLast-Modified: Tue, 01 Sep 2009 16:38:53 GMTCache-Control: no-store, no-cache, must-ridatePragma: no-cacheContent-Encoding: gzip

If Content-Encoding: gzip is returned, the webpage is compressed by gzip, that is, php gzip is effectively compressed.

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.