|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16109 zlib.output_compression and generated pictures
Submitted: 2002-03-15 16:53 UTC Modified: 2003-03-23 05:02 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: pguillot at paanjaru dot com Assigned:
Status: Closed Package: Zlib related
PHP Version: 4.1.2 OS: linux
Private report: No CVE-ID: None
 [2002-03-15 16:53 UTC] pguillot at paanjaru dot com

It seems a problem occurs when using
zlib.output_compression=Yes and generating pictures from
a script; The content of the picture seems to be compressed,
and not recognize by a browser ( Netscape ). It occurs
with jpeg and png files.

Strange because, if using mod_gzip with Apache the
picture is compressed __but__ still recognized by the

What is nice with zlib.output_compression is that nothing
needs to be modified in the scripts themselves, but i was
not able to find a way to stop compressing in a particular

Anyhow, thanks again to all, for the nice job done here.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-16 06:54 UTC]
This has already been reported.
 [2002-03-16 07:08 UTC] pguillot at paanjaru dot com
Which bug number is it ? I tried to find a bug report,
but didn't found any.
 [2002-04-03 06:32 UTC]
I'm 100% sure there is a bugreport for this. I don't know the number, I can't find it anymore...
 [2002-04-03 08:47 UTC]
If you can't find the number for the other bug report,
leave the report open..

 [2002-04-03 15:03 UTC] pguillot at paanjaru dot com
Thanks a lot Sniper !

After a little digging, the only bug report 'related' to
the problem discussed here seems bug #10905 which was
closed because of no feed back.

The strange point about what is happening is that
pictures .png or .jpeg are already compressed, due
to the format itself ... Also, if I use apache's mod_gzip
to compress again the pictures, it works, and other non script generated pictures are ok too.

Sounds weird. ;-)

 [2002-05-28 10:23 UTC] php at fatalfx dot com
When I look at it says that the value can be set anywhere (PHP_INI_ALL). Yes, that true what it has no effect. The master value on my computer is "on" and when I set it "off" at the beginning of my script it has no effect (even if phpinfo() tells the local value is "off"). So all pictures I read out from my database are not shown (broken image) in Netscape.

Why can't I switch it "off" in a particular script? Is it a problem with the headers (Content-Encoding)? I really would like to have it switched "on" to keep the data transfer as low as possible. But if my pictures aren't shown in Netscape it's of no use.

Actually, where is the bug? In the zlib? In Netscape?

 [2002-05-28 15:47 UTC] pguillot at paanjaru dot com
Welcome to the twilight zone ...
After a question from Roger Wetzel, I made a few more tests.
It seems the problem is on the netscape side :
I tested Netscape 7.0PR1 and the pictures are ok even with
zlib.output_compression enabled ...
Using my old Netscape 4.77 the problem remains even if the apache httpd.conf contains a KeepAlive set to Off or MaxRequestsPerChild set to 1 ... So it's should not be a keep-alive problem.
What still is in question is that when using mod_gzip, the problem doesn't occur.
So there is a workaround , either disable zlib.output_compression or use a decent mozilla/netscape.
 [2002-05-29 03:54 UTC] php at fatalfx dot com
Here's a short reproducing example script. Since the two pictures on the php info page are "generated" (inline) the script is very short:

<?php phpinfo(); ?>

Make sure your zlib.output_compression = On and you use Netscape Communicator 4.79 (Maybe the "bug" is in other Netscape version too but in 4.79 it is for sure).

 [2002-06-02 17:41 UTC]
Are you sure mod_gzip compresses the pictures?

Try to explicitly configure mod_gzip to compress images and please give us feedback if they work with your Netscape. I did a short test here and they also didn't work, so it seems really a Netscape problem.

Other test: Does it work if you switch of zlib.output_compression and instead compress the page via mod_gzip?
 [2002-07-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-07-28 10:20 UTC]
Should be fixed in latest CVS.

Now pages with image/ content-type header aren't compressed and you can use ini_set with zlib.output_compression during script execeution (before the headers are sent).
 [2003-03-22 14:10 UTC] phpuser at dpiworld dot com
What version will this fix show up in?  

I have php 4.1.2 and cannot successfully turn off output_compression in my image display script.  At least it makes no difference. I also specify a correct header for Content-Type: image/jpeg,  yet that fix also does not seem effective.

Internet Explorer 6.x (all patches installed) delays display of image data sent by my script for about 20 seconds or more and then they suddenly appear.  Had to turn off zlib.output_compression for entire domain due to this problem, and images are displayed normally again.
 [2003-03-23 05:02 UTC]
The change was committed to CVS July 2002, I think the first release with it was 4.3.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jan 27 10:01:24 2021 UTC