$_SERVER['DOCUMENT_ROOT'] and / , difference

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

$_SERVER['DOCUMENT_ROOT'] and / , difference

Post by klevis miho »

What is the difference between using $_SERVER['DOCUMENT_ROOT'] and just '/' ?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: $_SERVER['DOCUMENT_ROOT'] and / , difference

Post by Weirdan »

$_SERVER['DOCUMENT_ROOT'] stores filesystem location where '/' for this specific domain points to. So if you're site resides in /var/www/example.com $_SERVER['DOCUMENT_ROOT'] would give you exactly that, while to access it from browser you would use http://example.com/
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: $_SERVER['DOCUMENT_ROOT'] and / , difference

Post by klevis miho »

Thnx
Post Reply