Re: Getting The Document Root
| From: | John Nichel | Date: | Thu, 02 Feb 2006 15:27:06 +0000 |
| Subject: | Re: Getting The Document Root | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229730@lists.php.net to get a copy of this message | ||
Jeremy Privett wrote:
George Pitcher wrote:$_SERVER['DOCUMENT_ROOT'] http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.comJeremy, I think I lead you down the wrong path with my last reply. have a look at $_ENV['ORIG_PATH_TRANSLATED'] which, on my WinXP Apache2 box gives 'C:\Apache\Apache2\htdocs\testsite\phpinfo.php'. Is that what you are after? GeorgeI think my original message may have been confusing. I'll give a better example: I have a path: /home/jeremy/public_html/test/test.php What I want off of the path is just the "root" of the user's document root (e.g. where he stores all his publically viewable files): /home/jeremy/public_html/ Now, the document root can vary from server to server ... Like /var/www/ or /home/jeremy/www/ or whatever. So, I'd like to know if there was a way to dynamically fetch it, instead of putting together a list of the known document roots (hard-coding supported ones). I hope that makes more sense!