John wrote:
Is there a recognised (ie. reliable) way for a script to test
if it is being run from the command line or through a web server ?
Try
http://www.php.net/php_sapi_name
My guess whould have been :-
if (isset($_SERVER))
THEN it is being run from a web server.
But this may also be set when run through the CLI ?
Yes, for me $_SERVER is set both for PHP CLI and PHP as a Apache module;
however its contents are different.
for example:
$_SERVER['SERVER_ADDR'] only exists for the module
$_SERVER['argc'] only exists for the CLI
--
Mail to my "From:" address is readable by all at
http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!