RE: [PHP] Directory Command
| From: | Jennifer Goodie | Date: | Tue, 06 May 2003 22:54:14 +0000 |
| Subject: | RE: [PHP] Directory Command | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146590@lists.php.net to get a copy of this message | ||
> $_SERVER['DOCUMENT_ROOT']
That will return the document root for the site and not necessarily the
location of the script if the script is running in a subdirectory, or at
least that is what it is supposed to return, I guess if your server is
misconfigured it might return something else.
When in doubt create a file with a call to phpinfo() and see what is in your
env vars.
$_SERVER['PHP_SELF'] has filename of the script and path relative to the
document root, that might be what you want.
You can read about the values of predefined variables here
http://www.php.net/manual/en/reserved.variables.php,
but the best way to
become familiar with what is available on your server is to look at
phpinfo()'s output.
> -----Original Message-----
> From: Ernest E Vogelsinger [mailto:ernest@vogelsinger.at]
> Sent: Tuesday, May 06, 2003 3:21 PM
> To: Matt Palermo
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Directory Command
>
>
> At 23:55 06.05.2003, Matt Palermo said:
> --------------------[snip]--------------------
> >Does anyone know if there is a command that will return the URL
> >directory or location that the current script is running from?
> --------------------[snip]--------------------
>
> $_SERVER['DOCUMENT_ROOT']
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>