Re: Where am I?
| From: | John Taylor-Johnston | Date: | Wed, 18 Dec 2002 06:08:19 +0000 |
| Subject: | Re: Where am I? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128649@lists.php.net to get a copy of this message | ||
Hope you got your answer before now?
Run phpinfo(); inside a php file.
See:
$DOCUMENT_ROOT
or
$_SERVER["DOCUMENT_ROOT"]
All other variables you need are listed there. $_SERVER["TEMP"], for example, is very
useful. Don't forget to add the $ to the beginning of the variable name.
I couldn't actually find document_root in the FAQ search function, but phpinfo() is discussed
here:
http://www.php.net/manual/en/function.phpinfo.php
$DOCUMENT_ROOT is discussed here:
http://www.php.net/manual/en/language.variables.predefined.php
The WARNING is worth reading, should you ever upgrade to a newer executable of PHP for Windows. (I
have found it worthwhile.)
Warning
In PHP 4.2.0 and later, the default value for the PHP directive
register_globals is off. This is a major change in PHP. Having
register_globals off affects the set of predefined variables available in
the global scope. For example, to get DOCUMENT_ROOT you'll use
$_SERVER['DOCUMENT_ROOT'] instead of $DOCUMENT_ROOT, or $_GET['id'] from
the URL http://www.example.com/test.php?id=3
instead of $id, or
$_ENV['HOME'] instead of $HOME.
> I need to find the actual path of the root directory.