Detecting Server API (CGI or Apache) at runtime?
| From: | Richard Cyganiak | Date: | Sun, 23 Nov 2003 13:39:34 +0000 |
| Subject: | Detecting Server API (CGI or Apache) at runtime? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-170715@lists.php.net to get a copy of this message | ||
Hi all,
is there a way to tell at runtime if PHP is running as an Apache module or
through CGI?
phpinfo() shows this piece of information ("Server API" on the first page).
But is it available as a server variable or a constant or whatever?
I want to know this because I want to set the HTTP status code for a PHP
script, and AFAICT this has to be done differently, depending on the server
API:
header("HTTP/1.1 304 Not modified"); for the Apache module
header("Status: 304 Not modified"); for the CGI interface
If this can be done with the same PHP code on both server APIs, that would
solve my problem too.
Thanks in advance,
Richard