Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13084 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50026 invoked by uid 1010); 30 Sep 2004 21:40:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49696 invoked from network); 30 Sep 2004 21:40:28 -0000 Received: from unknown (HELO mail.omniti.com) (66.80.117.3) by pb1.pair.com with SMTP; 30 Sep 2004 21:40:28 -0000 Received: from ([66.80.117.2:49733]) by mail.omniti.com (ecelerity HEAD) with SMTP id 14/76-22587-F4D7C514 for ; Thu, 30 Sep 2004 17:40:34 -0400 In-Reply-To: <606653278.20040930171001@ionzoft.com> References: <606653278.20040930171001@ionzoft.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-ID: <3816BF62-1329-11D9-882C-000D93359332@omniti.com> Content-Transfer-Encoding: 7bit Cc: George Schlossnagle , internals@lists.php.net Date: Thu, 30 Sep 2004 17:39:33 -0400 To: Jason Garber X-Mailer: Apple Mail (2.619) Subject: Re: [PHP-DEV] CLI Constant From: george@omniti.com (George Schlossnagle) On Sep 30, 2004, at 5:10 PM, 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. > > If there is no better way, perhaps we could add constant called > (SAPI_TYPE = 'CLI') or something like that to the language to > facilitate this? You could use: define(SAPI_TYPE, strtoupper(php_sapi_name())); to get your constant. George