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/file.inc");


Or maybe you specify an include directory in your config:

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

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


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


As Dan has pointed out, the other option would be to use
$_SERVER['DOCUMENT_ROOT']:

$docroot = $_SERVER['DOCUMENT_ROOT'];

include("{$docroot}myfile.inc");


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])
wrote:

> 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 (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to