Is there a way to detect the name of the server running a PHP script from the command line?
There are numerous ways to do this for PHP accessed via HTTP. But there does not appear to be a way to do this for CLI.
For example:
$_SERVER['SERVER_NAME']
is not available from the command line.
question from:https://stackoverflow.com/questions/626416/php-server-name-from-command-line