Re: DOCUMENT_ROOT
| From: | Dan Lowe | Date: | Thu, 26 Apr 2001 03:50:03 +0000 |
| Subject: | Re: DOCUMENT_ROOT | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-50423@lists.php.net to get a copy of this message | ||
Previously, Jordan Elver said:
>
> I'm not using virtual hosts on my local machine but I am on the production
> machine. What should DOCUMENT_ROOT return? I though it returns the directory
> of the current script. So if I had a site in
> /usr/local/apache/htdocs/cha/script.php then I would expect DOCUMENT_ROOT to
> return /usr/local/apache/htdocs/cha/, is that right?
No, if you want to fetch that then do this:
$my_directory = dirname($PHP_SELF);
If you don't have register_globals on then you might have to do this
instead:
$my_directory= dirname($HTTP_SERVER_VARS['PHP_SELF']);
Should end up with "/usr/local/apache/htdocs/cha" in $my_directory (in this
particular case).
$DOCUMENT_ROOT is whatever your httpd.conf file says DocumentRoot is.
Even if you don't use virtualhosts, there should be a DocumentRoot in one
of your Apache config files. I believe Apache will complain loudly on
startup if that parameter is missing.
-dan
--
Plan to be spontaneous - tomorrow.