View Full Version : [ubuntu] php setup incorrect?

February 23rd, 2010, 09:20 PM
I recently set up apache/mysql/php server on karmic and all seems to be running well, until I try to display an image with html in a php page. Firefox tells me the linked file (a png) is text format. Oddly enough, the same page works perfectly in a pure HTML page. Where do I start sorting this out?

February 23rd, 2010, 09:23 PM
does phpinfo(); work?

February 24th, 2010, 11:30 AM
yes it does

February 24th, 2010, 11:35 PM
I am not sure I understand the issue. Say you have a page with a picture in an <img> tag. If the extension is html it works been if you change the extension to php it does not?


February 25th, 2010, 12:28 PM
It does work if the extension is html. If I change the extension to php, I can only see what's in the <img> tag if the image is in the same directory as the php file.

February 25th, 2010, 12:32 PM
Can you show the code and the markup of the page?

February 25th, 2010, 12:48 PM
sure - this works in php:

<p>Aquarium Pages</p>
links to:<br />
<a href=""><img src='Burn.png' alt="icon" width="45" height="45" /></a><br />
<a href="">my aquarium</a><br />

and if i change the src= to /Burn.png or /png/Burn.png to doesn't.

February 25th, 2010, 03:23 PM
It's not a php problem since it doesn't generate the code.
Simply use a standard way of html coding:

<img src="Burn.png" alt="icon" width="45" height="45" />
And try also to keep from using uppercase characters - some severs don't "like" it.

February 25th, 2010, 04:41 PM
sure - this works in php:
and if i change the src= to /Burn.png or /png/Burn.png to doesn't.

I think the problem is the leading /. If you start the path with a /, it starts from the filesystem root, which is probably not what you want. try 'png/Burn.png' not '/png/Burn.png'

February 26th, 2010, 11:40 AM
That's got me sorted out. Thanks!