Best method to detect Apache, IIS, or CLI?
| From: | Jean-Pierre Arneodo | Date: | Wed, 04 Jun 2003 15:07:15 +0000 |
| Subject: | Best method to detect Apache, IIS, or CLI? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150187@lists.php.net to get a copy of this message | ||
Hi,
what is the best method to detect if a php script is started
into Apache, IIS or in a CLI script?
I've found several issues, but I am not sure to be right.
* CLI:
- PHP_SELF='-'
- var $argv, $argc exist
- constant STDIN, STDOUT, STDERR exist
* http server:
- PHP_SELF != '-' for ever
- $argv, $argc not found (in my apache install)
- constant STDIN, STDOUT, STDERR not exist, but they can be defined by someone else
* But I don't know between Apache and IIS.
Thanks
Jean-Pierre