Root versus Folder Level Confusion
Posted by: Hootie (---.abhsia.telus.net)
Date: December 27, 2007 03:45AM

Hi,

Just set up WampServer2 and it appears to be great! However I'm having one issue which shows up as images not appearing on the webpages. Here is what is happening...

MySQL contains data that indicates the location of images stored in the website. This data is text in the form: /images/picA.jpg.

My website is in C:/wamp/www/website and the image files are in the folder C:/wamp/www/website/images/

Using WampServer 2 the webpages in the browser are trying to find the images at www/images/ instead of at www/website/images/ but of course there are no images there, they are in the folder in the website where they belong.

I would have expected that in WampServer2 that everything would work relative to the website folder in order to emulate that each folder in WampServer2 is just like being at root, but it doesnt seem to.

Any idea how this can be fixed. This website worked fine in a number of production situations as a main domain, a subdomain and also just in a subfolder.

Appreciate any and all help. Thanks.

Options: ReplyQuote
Re: Root versus Folder Level Confusion
Posted by: toivo (203.19.130.---)
Date: December 27, 2007 07:36AM

Hi,

The content of the dynamic webpages created by a PHP application is a product of the PHP application code but also by any bugs that have slipped through during testing, rather than something in WAMP itself.

I assume the other webservers you were running your website were not WAMP. One possibility that comes to mind is the version of PHP supported by the other webservers. If they were running PHP4, the PHP code which generates the links to the images may be using short open tags, <?, instead of the normal version <?php. Because WAMP runs PHP 5, the short open tag support is off by default. This can cause differences in the results. It is possible to turn on the support for short open tags by changing a setting in the php.ini file.

If this is not the case, you need to find out or get someone with PHP skills to find out from the source code of your PHP application how it generates the path to the image file and why the folder is not part of it. Usually applications and CMS systems have a configuration file which specifies to the application where for example the image folder is.

Regards,

toivo
Sydney, Australia

Options: ReplyQuote
Re: Root versus Folder Level Confusion
Posted by: Hootie (---.abhsia.telus.net)
Date: December 27, 2007 05:44PM

Hi,

Thanks toivo for your quick and thoughtful repsonse. I changing the data in MySQL from the form "/images/pic1039.jpg" to "images/pic1039.jpg" and it solved the issue. I think the first slash indicated to look relative to the Apache document root www, whereas without the slash it looks relative to the website folder. Works fine now and it is not a WAMP issue.

By the way, I am using <?php tags and am using PHP4 in WAMP and on the production servers. When I switch to PHP5 in WAMP the site doesnt work, but that will be another hill to climb on another day, unless you think of something obvious for me to look for. Here is a snippet.

<img src="<?php echo $row_RS_Cat['Image']; ?>" alt="" name="" width="320" height="60">

(This isnt a WAMP issue so I'll understand if no reply.)

Anyway, thanks very much. I have to say, being able to easily switch between versions of Apache, PHP and MySQL for multiple development sites is really really helpful. Thanks to Romain Bourdon.

Regards,

Hootie
Sherwood Park, Canada

Options: ReplyQuote


Sorry, only registered users may post in this forum.