|
Posted by Dave on 02/20/05 19:15
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.
--
Dave Gutteridge
dave@tokyocomedy.com
[Back to original message]
|