PHP: no output on the Gzip page
- Output_buffering = Off
- Output_handler =
- 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 ):
- 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:
- 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: gzipIf Content-Encoding: gzip is returned, the webpage is compressed by gzip, that is, php gzip is effectively compressed. |