PDA

View Full Version : [ubuntu] php setup incorrect?



edothas
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?

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

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

mcarrara
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?

Mark

edothas
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.

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

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

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


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

AlexDudko
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.

tlsarles
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'

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