Re: php and apache path...

From: Date: Wed, 03 Jul 2002 02:51:09 +0000
Subject: Re: php and apache path...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-105110@lists.php.net to get a copy of this message
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 (danielc@analysisandsolutions.com) 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

« previous php.general (#105110) next »