The $_SERVER variables are only available in a server environment (hosting PHP through Apache or another web server), so if you are launching it from the command line they won't be available. The parameters of this object are populated by the HTTP headers, which in your case don't exist.

If you want to ignore the $_SERVER object when the SERVER_NAME isn't set, you can alternative use php_uname("n") but your mileage may vary depending on operating system.

$server_name = (isset($_SERVER['SERVER_NAME']))? // check if SERVER_NAME is set
    $_SERVER['SERVER_NAME'] :                    // if yes, use HTTP header value
    php_uname("n");                             // if no, use php_uname()


Index "server_name" not exist
I am not a native English speaker. I am writing an email to my boss and I want him to know an important thing, so will it be ok to say "I wanted you to know that ...", it is offensive/mean etc in any sense ?
