Re: [NEWBIE] Confused about usage of $_SERVER['DOCUMENT_ROOT']

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What's Up Dave... yeah, regardless of how deep this goes into the servers file structure, it should pull out the same thing in the end. Please print out the response and let us know what happens.

Dave wrote:

PHP General,

The Situation:
I would like to be able to specify locations of scripts and files relative to the "root" directory from which my web site is served. I thought this was what $_SERVER['DOCUMENT_ROOT'] was for.


The Problem:
When I use $_SERVER['DOCUMENT_ROOT'], it creates a path starting from somewhere deep down in the server's file structure, below where I even have authorized access. So if I specify a file like so:
$imageFile = $_SERVER['DOCUMENT_ROOT'] . "/images/image.jpg";
... PHP gets lost and doesn't locate it.
What I am looking for is a variable which will specify the base directory that my web site is rooted in. In other words, starting from the same directory that my index.html file is in.


The Question:
How do I specify the directory that my web site is situated in, the same directory where my main index.html file is? Is there a different variable I should be using, or perhaps some configuration of $_SERVER['DOCUMENT_ROOT'] that needs to be applied?


What I've Tried So Far:
First I went to the on line PHP manual, which is where I found out about $_SERVER['DOCUMENT_ROOT'] in the first place. Of all the server variables available, 'DOCUMENT_ROOT' seems to describe what I'm looking for, but doesn't behave how I would expect.
A Google search was equally ineffective in educating me in what basic concept I am missing.


   Any advice would be much appreciated.


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux