Re: How to obtain the script's path?

From: Date: Tue, 12 Feb 2002 22:01:35 +0000
Subject: Re: How to obtain the script's path?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-84473@lists.php.net to get a copy of this message
On Tue, 2002-02-12 at 13:44, Alex Shi wrote: > Hi, > > I have a script need to be launched from terminal, and I want > it to report the script's path. Because this script is required to > be launched from command line, so those Apache env vars > have not effect work, even $PHP_SELF don't work. > Can anybody has a solution for this? Thanks in advance for > any answers! > > Regards, > > Alex One way to do it: #!/usr/local/bin/php -q <?php error_reporting(E_ALL); $path_to_me = getcwd() . '/' . basename($argv[0]); echo $path_to_me; ?> Hope this helps, Torben -- Torben Wilson <torben@php.net> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506

« previous php.general (#84473) next »