Forum Moderators: coopster

Message Too Old, No Replies

Defining server paths in php

tutorials?

         

ukgimp

3:58 pm on Feb 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Until know I have managed to blag my way through defining paths when using php. Until the last two hours when it has driven me insane.

I have to define the wwwroot and the directory root to get something to work. Are there any good resources where I can find out how to do this from first principles?

I know a few things like

../ to go up a dir

but I am having trouble when I need stuff like /home/httpd/html and I think my difficulties lie in the relative and absolute paths and not knowing how to define them fully.

Any suggestions.

Cheers

andreasfriedrich

4:18 pm on Feb 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There isnīt much to it:

  • anything that starts with a / is an absolute path.
  • / is the root of either your filesystem or the URI namespace of your domain
  • ./ is just the directory you are in
  • ../ goes down one directory

You need to know whether any path will be in the URI namespace (un) or the filesystem namespace (fn). The DocumentRoot [httpd.apache.org] directive will determine which directory in your fn is the un root directory. Additionally there may be any number of Alias [httpd.apache.org] or AliasMatch [httpd.apache.org] directives that map a certain fn directory to a un directory.

Some infos on how relative URIs are resolved and links to the RFCs can be found here:
Bag-O-Tricks for PHP II - some code snippets that should be helpful for all in creating dynamic sites - Resolving a relative URI [webmasterworld.com]

Andreas