RE: [PHP-DEV] CLI Constant
| From: | Michael Sims | Date: | Thu, 30 Sep 2004 21:45:52 +0000 |
| Subject: | RE: [PHP-DEV] CLI Constant | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13085@lists.php.net to get a copy of this message | ||
Jason Garber wrote:
> Hello internals,
>
> What is the best way, from within a php script, to tell that the
> script is being run on the command line?
>
> I've used if(defined('STDIN')) but that seems kind of kludgey.
I've used
if (php_sapi_name() == 'cli') ...
which seems to work well.