... or the other way around, is there any way to know if a php script is running inside a web server?
http://www.php.net/manual/en/function.php-sapi-name.php
function is_cli()
{
    return php_sapi_name() === 'cli';
}
                        Typically, when running in CLI mode, the superglobals $argv and $argc will be set, and many of the typical contents of $_SERVER (e.g. request method) won't be available. In addition, pre-defined console streams such as STDIN, STDOUT and STDERR will be set up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With