pmsguy
asked on
How does my PHP script know if it is run by a browser or command line?
I want my php script to know if it is run by the browser or by the command line.
How do I tell the difference?
argv==NULL means browser?
How do I tell the difference?
argv==NULL means browser?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@davbladwin - PHP is now becoming popular to run command line as well as on a server
Using PHP from the commnad line
http://php.net/manual/en/features.commandline.php
http://php.net/manual/en/features.commandline.php
@chilternPC, yes i know. I have some text processing utilities running PHP from the command line on this computer. @pmsguy just wants to be able to tell the difference.
It is a matter of symantics, but what I think DaveBaldwin is trying to say that no matter how it is envoked Php is what would be condidered Server Side in a Client-Server app. Even if envoked by command line it is running on the server and merely feeding the client.
What I think pmsguy is wanting to know is how was the server side code envoked? You guys both have already given him tools to ascertain this information.
What I think pmsguy is wanting to know is how was the server side code envoked? You guys both have already given him tools to ascertain this information.