douzuqin3467 2016-08-25 09:29
浏览 94

需要获取部署/运行我的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

  • 写回答

1条回答 默认 最新

  • duanbin4847 2016-08-28 18:20
    关注

    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

    评论

报告相同问题?

悬赏问题

  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码