In your config file (or at the top of each page) you should establish what
your document root is:

$docroot = "/usr/home/sitename/";    # or whatever

Then do something like include("{$docroot}inc_dir/");

Or maybe you specify an include directory in your config:

$incdir = "/usr/home/sitename/inc/";    # or whatever

Then do something like include("{$incdir}");

Or maybe write a small function that allows you to do it all
transparently... maybe something like myinclude('').

As Dan has pointed out, the other option would be to use

$docroot = $_SERVER['DOCUMENT_ROOT'];


I don't believe it can be done with ~/ or ./ or something... haven't found
it yet!!

Justin French

on 03/07/02 1:34 AM, Analysis & Solutions ([EMAIL PROTECTED])

> On Tue, Jul 02, 2002 at 03:47:20PM +0200, Nightshade wrote:
>> is there a unix like ~/ , to access to root directory of my site
> Does $_SERVER['DOCUMENT_ROOT'] help?
> Whenever you have a question like this, run phpinfo() and see what's there
> which produces the variable you're looking for.
> --Dan

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to