Re: Getting the script path of a commandline script
| From: | DL Neil | Date: | Tue, 26 Nov 2002 19:26:40 +0000 |
| Subject: | Re: Getting the script path of a commandline script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126158@lists.php.net to get a copy of this message | ||
Ryan,
> Anyone know how to get the script path (not the current working directory,
> but the actual path of the executing script) of a commandline script?
>
> I've dug through the docs and can't find this anywhere. None of the
> typical $_SERVER variables return the script path (although several of
> them return the filename, hooray for redundancy). The docs say several
> times that getcwd() will NOT return the path of the executing script, but
> they don't mention how to get it.
_SERVER["argv"] [ 0 ] gives the full path to the script (including the
script's name and filetype)
=dn
PS if you want to know more, run the standard PHPINFO() through the command
line, piping to an output.HTML file, then drop that into your browser!