Use getenv() instead of $_SERVER for env variables

Not all server setups will populate $_SERVER with environment variables.