Home > Article > Backend Development > Solution to the problem of no output when Gzip page is enabled in PHP
to enable gzip acceleration for the entire site's php files. For html files, you can configure the .htaccess file and let php handle html requests (it will increase the load on the server. It is recommended to do gzip processing on nginx or apache):
Question: PHP5.3 installed by default, once the Gzip compression output function is turned on, the homepage of the website will not be displayed. This is caused by a problem with PHP configuration. The default configuration in 5.3 is as follows: output_buffering=4096; Set it to off or 0 to solve the problem. It has been verified that this problem exists in PHP 5.1 - PHP5.2. Don’t worry about whether it will affect compression or not compress at all. You can use the following method to judge:
HTTP/1.1 200 OK Server: nginx/0.8.13 Date: Tue, 01 Sep 2009 16:38:53 GMT Content-Type: text/html Connection: keep-alive Vary: Accept-Encoding X-Powered-By: PHP/5.2.10 Expires: Mon, 26 Jul 1997 05:00:00 GMT Last-Modified: Tue, 01 Sep 2009 16:38:53 GMT Cache-Control: no-store, no-cache, must-ridate Pragma: no-cache Content-Encoding: gzip If the result contains the sentence: Content-Encoding: gzip, it means that the webpage is gzip compressed, that is, php gzip compression is effective. |