需要获取部署/运行我的PHP应用程序的服务器主机名

These are the things I have tried :

  1. $_SERVER['SERVER_NAME'] : sub..amazinglocal.com

  2. $_SERVER['HTTP_HOST'] : amazinglocal.com

  3. php_uname('n') : sub..amazinglocal.com

  4. gethostbyname()

I need the kind of name that is the output of command hostname on the server.

Example : appmysql.staging.la3.do.amazing.com

Okay so I've tried a couple of more options and this one works the best : gethostname()

gethostname() : vagrant-ubuntu-trusty-64

On the server, it'll throw an ouput like :

mysqlapp1.prod.do.superawesomeserver.com