No, document root is a defined directory, not an attribute of a specific 
file. It is used to map the root URL to a directory on the filesystem.

For example, when you request http://www.google.com/, that final slash 
in the URL is the resource you are requesting. In this case, it is the 
root URL for that domain, and everything branches off from that 

Document root is the filesystem directory that is equivalent to the root 
URL and is used by the Web server to locate the requested resource. 
Thus, everything within this directory is (potentially, depending on 
permissions) accessible via a URL. For example, if the document root for 
Google were /usr/local/apache/htdocs/, then the URL 
http://www.google.com/foo/bar/blah.php would be equivalent to 
/usr/local/apache/htdocs/foo/bar/blah.php on the filesystem.

Hope that clarifies.


John W. Holmes wrote:

>You want DOCUMENT_ROOT. If you have a file
>then, from within that file.php, DOCUMENT_ROOT is
>I think it would be $_SERVER['DOCUMENT_ROOT'] in newer versions of PHP.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to