auto detect CLI

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
How can I detect in php that I am running from CLI (command line), and
not the browser.   I hate to put a constant in each script:
e.g. define(’CLI’, 1)...

-- /  This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL:
Visit Topic URL to contact author (reg. req'd).  Report abuse:

Re: auto detect CLI

["Followup-To:" header set to comp.lang.php.]
steve wrote:
Quoted text here. Click to load it

and, since you're already reading the manual,
also read about command line features:
USENET would be a better place if everybody read:    | to  mail  me:  simply |    | "reply" to this post, |      | *NO* MIME, plain text |                     | and *NO* attachments. |

Site Timeline