Koozali.org: home of the SME Server

PHP in ibay with include files, relative paths not found

Joachim Koenen

PHP in ibay with include files, relative paths not found
« on: November 15, 2002, 12:42:31 PM »
Hi everybody,
we have some PHP4 webpages in an ibay of our SME5.5.
This PHP uses inc files, which are in subdirectories.
A link within this file like

     src="../images/rechts_about.jpg" vspace="30" hspace="12" width="224" height="224">

should result in an access to the file http://myserver/myebay/images/rechts_about.jpg
but in fact it tries to access
http://myserver/images/rechts_about.jpg
which does not exist.

I tried

/sbin/e-smith/db accounts setprop myibay PHPBaseDir /home/e-smith/files/ibays/myibay
/sbin/e-smith/signal-event ibay-modify myibay

but still it is not working.

TIA

Joachim Koenen

Jon Blakely

Re: PHP in ibay with include files, relative paths not found
« Reply #1 on: November 15, 2002, 01:56:54 PM »
Just modify the script to use the full url

src="http://myserver/myebay/images/rechts_about.jpg"

Jon

Joachim Koenen

Re: PHP in ibay with include files, relative paths not found
« Reply #2 on: November 15, 2002, 02:13:17 PM »
But hen the code isn't portable anymore and we want to use the same code
on different servers.

Joachim Koenen

Sean Reynaud

Re: PHP in ibay with include files, relative paths not found
« Reply #3 on: November 15, 2002, 05:11:00 PM »
If the images directory is at the same level as the PHP file, then simply modify your IMG tag.  Currently, you have it set up to go up a directory with the ..




/sean

Joachim Koenen

Re: PHP in ibay with include files, relative paths not found
« Reply #4 on: November 15, 2002, 05:43:15 PM »
The image directory is on level up and one level down.
The pages work in the primary dirctory of the SME  and also on other apache machines.

Nathan Fowler

Re: PHP in ibay with include files, relative paths not found
« Reply #5 on: November 15, 2002, 06:43:24 PM »
The problem is in your IMG tag you are referrencing ../, which is the parent directory to the root directory.  If you changed this to ./ it would be the root directory + images, which would work.

Note, you could also create a virtual domain, and by using a FQDN you could use ../ in addition to / or ./ to specify the root domain.

You're going to have to modify you're code unless you create a virtual domain.  This isn't a bug or a problem, this is by design.

Hope this helped,
Nathan