[Gllug] php, Apache and relative paths.

Lucy Bartosik lucy at bartosik.co.uk
Thu Jan 24 17:40:33 UTC 2002


On Mon, 2002-01-21 at 11:35, Simon Stewart wrote:
> On Sun, Jan 20, 2002 at 10:38:56AM +0000, Lucy Bartosik wrote:
> > In php scripts I am unable to use relative paths for links in the
> > password protected area.  I therefore have to put the full path in which
> > will slow matters down considerably.
> 
> Which sort of relative paths? PHP and a web server have very slightly
> different ideas about what "relative" means, though the idea is the
> same. PHP takes paths from the actual filesystem of the box that it's
> running on, allowing you to keep things such as database includes in a
> seperate place outside of the htdocs tree. A relative path from a
> served web page is relative to the DocumentRoot.
> 
> That appears to be nonsense, so perhaps an example would help:
> 
> >         </Directory>
> >         <Directory /var/www/ukadis/htdocs/secure>
> >         AuthName "UKADIS Members area"
> >         AuthUserFile /var/www/ukadis/ukadis.htaccess
> >         </Directory>
> 
> >From this, it looks like the DocumentRoot of the site probably points
> to "/var/www/ukadis/htdocs/" (that is, the secure area is reached by
> going to "http://somewhere.co.uk/secure/")
> 
> So:
> 
> ----- PHP page
> 
> <html>
> <head><title>Example missing out sgml doctype</title></head>
> <body>
> 
> <!-- This link points to /var/www.ukadis/htdocs/secure/page.html -->
> <p>This is a <a href="/secure/page.html">link</a>
> 
> <? 
> // Whereas this points to exactly where it says on the local FS
> include "/secure/page.html"; 
> ?>
> 
> </body>
> </html>

Yes that helps enormously.  Thanks for all the suggestions.  

I spent a lot of time going round in circles, for when I tried to
correct one area I would get a different error.  - I had used scp as a
different user and also has permissions issues too :-)

Thank you.

Lucy


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list