Re: [PHP] $ENV['SCRIPT_FILENAME']
On 5/14/06, Ryan A <[EMAIL PROTECTED]> wrote: Anyone have an idea of a variable (eg: $_SERVER['REQUEST_METHOD'] ) that will be set only if called via the web and ignored if called via cli? I have no experience with CLI, and haven't tested this, but I believe that any time a request comes through a web browser, the $_GET and $_POST values are set, even if they're empty. This may go for the $_COOKIE global as well. So you could simply check if one of these are set: isset($_POST) But again I have no CLI experience, so I could be off. But it's worth testing... HTH, John W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $ENV['SCRIPT_FILENAME']
Way back in Olden Times (PHP 3.0) $_ENV used to be called $ENV, back when $_POST was $HTTP_POST_VARS and similarly for GET and such-like. You've got some old code relying on the deprecated syntax. You can either hack your php.ini to support old-school var names, or you can change all $ENV to $_ENV. You'll have to change them sooner or later anyway, I think, because I *THINK* the old-school names might be going away in PHP 6??? You could check that by Googling PHP 6 Roadmap but you oughta change it anyway. On Sun, May 14, 2006 1:59 pm, 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 > > -- > - The faulty interface lies between the chair and the keyboard. > - Creativity is great, but plagiarism is faster! > - Smile, everyone loves a moron. :-) > - > Fight back spam! Download the Blue Frog. > http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $ENV['SCRIPT_FILENAME']
Hey guys, Thanks for replying. I have figured out what he is trying to do basically he wants to know if the script is being called via the web or via CLI... if called via the web he wants to display the welcomeScreen() if not he wants to do other stuff... Problem is, that ENV thing is wrong so I changed it to $_SERVER, but it is still looping in that place... Anyone have an idea of a variable (eg: $_SERVER['REQUEST_METHOD'] ) that will be set only if called via the web and ignored if called via cli? BTW, i tried $_SERVER['REQUEST_METHOD'] but not working :-( Thanks! Ryan --- tedd <[EMAIL PROTECTED]> wrote: > 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(""); > print_r($_ENV); > echo(""); > > 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 > -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) - Fight back spam! Download the Blue Frog. http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $ENV['SCRIPT_FILENAME']
Unless there is an other piece of code filling up the $ENV array - possibly a cleaning routine. On 5/14/06, Rory Browne <[EMAIL PROTECTED]> wrote: Sorry - what's your question? I think that $ENV should be $_ENV, which in turn should be $_SERVER. On 5/14/06, Ryan A < [EMAIL PROTECTED]> 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 > > -- > - The faulty interface lies between the chair and the keyboard. > - Creativity is great, but plagiarism is faster! > - Smile, everyone loves a moron. :-) > - > Fight back spam! Download the Blue Frog. > http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] $ENV['SCRIPT_FILENAME']
Sorry - what's your question? I think that $ENV should be $_ENV, which in turn should be $_SERVER. On 5/14/06, Ryan A <[EMAIL PROTECTED]> 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 -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) - Fight back spam! Download the Blue Frog. http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $ENV['SCRIPT_FILENAME']
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(""); print_r($_ENV); echo(""); 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $ENV['SCRIPT_FILENAME']
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 -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) - Fight back spam! Download the Blue Frog. http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php