Re: $ENV['SCRIPT_FILENAME']

From: Date: Sun, 14 May 2006 20:15:49 +0000
Subject: Re: $ENV['SCRIPT_FILENAME']
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236156@lists.php.net to get a copy of this message
At 11:59 AM -0700 5/14/06, Ryan A wrote:
Hi, I am going through another persons script (which is not working) and have come accross this: if (isset($ENV['SCRIPT_FILENAME'])) {
      $CLIENT_PATH= dirname($ENV['SCRIPT_FILENAME']);
      WelcomeScreen();
      TestSetup($TH_HASH);
      exit;
} I am just starting on CLI stuff but I cant find much references to $ENV['SCRIPT_FILENAME'], reading the manual I know there is a $_ENV superglobal but just $ENV? I am pipeing some log data from apache to this script but while debuggin I have noticed that i does not go further than the above if() statement... and that part IS needed because if accesseed via a POST it should execute that code and show the WelcomeScreen() Even a RTFM with a reference in the manual would be appreciated. Thanks! Ryan
Ryan: Try this to see if SCRIPT_FILENAME exist: echo("<pre>"); print_r($_ENV); echo("</pre>"); If I remember correctly (maybe not), but not all environmental variables are always present. However, SCRIPT_FILENAME should provide you the path of the script that contains the call. If it's not there, then look to see if PATH_TRANSLATED is present, because that will provide the same result. hth's tedd -- ------------------------------------------------------------------------------------ http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#236156) next »