Say you have a directory, safe, that is outside the public folder, www -- both of these are under the location of C://lhost/. How do I get to the directory safe? I know you can do '../' but I have to assume that we could be on any level of the directory tree. Is there anything like $_SERVER['DOCUMENT_ROOT'] that will give you the directory lhost?
Cheers.
Accessing above document root.
Moderator: General Moderators
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
- The_Anomaly
- Forum Contributor
- Posts: 196
- Joined: Fri Aug 08, 2008 4:56 pm
- Location: Tirana, Albania
Re: Accessing above document root.
I'm not sure if this answers you question, but at least in Linux you can use concrete paths, i.e. "/var/www/test.php." In your case, I'd imagine that it would be "c:/lhost/safe/test.php." Although, if you're asking for a PHP function that gets the parent of the document_root, I wouldn't know.
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
Re: Accessing above document root.
You have given me enough info to help.The_Anomaly wrote:I'm not sure if this answers you question, but at least in Linux you can use concrete paths, i.e. "/var/www/test.php." In your case, I'd imagine that it would be "c:/lhost/safe/test.php." Although, if you're asking for a PHP function that gets the parent of the document_root, I wouldn't know.
I could just store 'c://lhost/' in a constant and then change it accordingly on different servers.
Cheers.
- The_Anomaly
- Forum Contributor
- Posts: 196
- Joined: Fri Aug 08, 2008 4:56 pm
- Location: Tirana, Albania
Re: Accessing above document root.
Glad I could helpmarkusn00b wrote:You have given me enough info to help.The_Anomaly wrote:I'm not sure if this answers you question, but at least in Linux you can use concrete paths, i.e. "/var/www/test.php." In your case, I'd imagine that it would be "c:/lhost/safe/test.php." Although, if you're asking for a PHP function that gets the parent of the document_root, I wouldn't know.
I could just store 'c://lhost/' in a constant and then change it accordingly on different servers.
Cheers.
I would be interested though if any other members have a better way of doing this, perhaps through some PHP function I don't know about.