How to display .png?

Christian Walther cptsalek at
Fri Feb 16 13:12:16 UTC 2007

On 16/02/07, Roger Olofsson <raggen at> wrote:
> Dear Mailing List,
> As usual, thanks alot for all answers to my previous questions! I will
> try and step up and answer the ones I can.
> I'm still fiddling around with a machine that's upgraded to 6.2 and have
> encountered a small thing. Apache refuses to display .png pictures. This
> is probably some setting somewhere and I have looked in the following:
> httpd.conf of course
> php.ini
> I have reinstalled and checked options for php5, I have checked options
> and reinstalled gd and I have compared httpd.conf and php.ini with a
> FreeBSD 5.5, I have run phpinfo on both machines and compared the
> results, they look very much alike. The 5.5 displays .pngs fine though.
> I have also checked file permissions for the pictures, they all look
> fine. The output of httpd-error.log has no pointers.
> What could be the magic trick? Probably something really simple?

Apache doesn't display images, it just serves them. That is to say
they are downloaded to the browser like any other file is, and the
browser displays them.
So, what configuration are you using? From what you've given so far
you obviously have to different machines.
What about the ./htdocs tree, is it the same on both machines, e.g.
did you copy it from the 5.5 machine to the new one? Where is the
browser running? Is it running locally on the 6.2 machine, or do you
have a third machine from which you access both servers?
How do you access the png-Images? Are they embedded in a web page,
e.g.  by a <img src="" alt="" /> tag, or do you follow a link?

How does it look like in your web browser? Is the image missing
entirely, or do you have a "broken image" icon where you expect the
image to be? If there is such an icon, what are its properties? (If
you're using firefox you can right click on the image icon and select
If there is no icon, does anything strange happen, e.g. does your
browser display weird lines of text, or does it open a save as-dialog?

What I think is possible is that there is a difference in the
mime-type definition of both servers. If a file is requested from a
web server the server sends a header that hopefully contains the right
mime type. Depending on the mime-type the browser decides what it can
do with it. So if there is no definition for png on your server, it
might either be sent as a text- or binary file, resulting in strange
behaviour in your web browser.


More information about the freebsd-questions mailing list