ID: 30507 Comment by: shinji257 at uplink dot net Reported By: webmaster at ex-centris dot com Status: Open Bug Type: Zlib Related Operating System: RedHat Enterprise Linux 3 PHP Version: 5.0.2 New Comment:
I should correct myself. Content-Encoding isn't being set. The chunked bit was from teh Transfer-Encoding section of the header. Anyways here are headers for you. They both have Gzip set to on in php.ini but the first is from a straight phpinfo script (just getting info from php) and the second has the header explicitly added for the Content-Encoding of gzip before phpinfo() is called. http://shinji.chaosnet.org/phpinfo.php GET /phpinfo.php HTTP/1.1 Host: shinji.chaosnet.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: [censored] HTTP/1.x 200 OK Date: Tue, 16 Nov 2004 15:23:09 GMT Server: Apache/1.3.29 (Unix) X-Powered-By: PHP/4.3.6 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html ----------------------------------------------------------------- http://shinji.chaosnet.org/phpinfo.php GET /phpinfo.php HTTP/1.1 Host: shinji.chaosnet.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: [censored] Cache-Control: max-age=0 HTTP/1.x 200 OK Date: Tue, 16 Nov 2004 15:25:07 GMT Server: Apache/1.3.29 (Unix) Content-Encoding: gzip X-Powered-By: PHP/4.3.6 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html The Content-Encoding line needs to be there as once it got in the page was retrieved just fine. Otherwise it comes up as garbage. Previous Comments: ------------------------------------------------------------------------ [2004-11-16 16:17:02] shinji257 at uplink dot net I can confirm this bug. PHP 4.3.6 Zlib support as loadable module linked to library version 1.1.4 zlib.output_compression = On causes scrambled output likely to be the gzip compressed version of the information for the browser but the browser doesn't know it is compressed. Content-Encoding header is set as Chunked instead of gzip. ------------------------------------------------------------------------ [2004-10-21 02:44:24] webmaster at ex-centris dot com Description: ------------ I enabled automatic gzip compression with the following line in php.ini: zlib.output_compression = on The problem is that the Content-Encoding header does not get set at all in the response. Therefore, a browser that advertises itself as supporting gzip compression (Accept-Encoding: gzip,deflate) receives compressed content but does not know it is compressed. If I manually add the following to my script: header("Content-Encoding: gzip"); ... it then works. This was tried in the Safari and Firefox clients on Mac OS X. Server is RedHat Enterprise Linux 3 running kernel 2.4.21-20. PHP 5.0.2 running as a module of Apache2 2.0.46. If you need other details do not hesitate to contact me. Thank you. P.S. Even though I compiled PHP with: ./configure --with-apxs2 --with-mysql --with-zlib if I call phpinfo, here what it shows: ./configure --with-apxs2 --with-mysql Reproduce code: --------------- <?php print 'Here is some output !!!'; ?> Expected result: ---------------- Here is some output !!! Actual result: -------------- ??H-JU?,V(??MU?/-)(-QPTT???D?M ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30507&edit=1