|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-03-12 00:10 UTC] plasmahh at gmx dot net
Description: ------------ When setting zlib.output_compression in php.ini and outputting any page (tried with <? phpinfo(); ?>) no proper headers are sent. From zlib manual : Whether to transparently compress pages. If this option is set to "On" in php.ini or the Apache configuration, pages are compressed if the browser sends an "Accept-Encoding: gzip" or "deflate" header. "Content-Encoding: gzip" (respectively "deflate") and "Vary: Accept-Encoding" headers are added to the output. It looks like in zlib.c the php_enable_output_compression function should enable the compression, which it also does (the data is sent gzipped properly if the client has a proper Accept-Encoding header sent) but nowhere in there is a header sent with Content-Encoding. The only occurence is in the ob_gzhandler but it seems like this is a totally different feature. I have set a header output in my php_enable_output_compression and it works for me, dont know if this is the proper solution. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
Does not work too with the snapshot... I have changed parts of the php_enable_output_compression as followed, which works around my problem... if (php_memnstr(Z_STRVAL_PP(a_encoding), "gzip", 4, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) { ZLIBG(compression_coding) = CODING_GZIP; sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1); } else if (php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) { ZLIBG(compression_coding) = CODING_DEFLATE; sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1); } else { return FAILURE; }I had this same problem when I upgraded an existing install to php 5.3. Turns out that the problem is ext/zlib. When I de-activated that module it behaved as expected. Not sure if that means this is a php bug or a ext/zlib bug, but at least it's reproducible! Hope that helps someone. My config (in httpd.conf): # enable php gzip php_flag zlib.output_compression On php_value zlib.output_compression_level 9 One more thing to add, although it "works" when zlib is disabled, there is no compression!