0

I'm looking to retrieve the ServerName field located in /etc/apache2/apache2.conf. My only issue is then calling it in PHP (echo $_SERVER['SERVER_NAME'];) it gives me not the server name but the ip address.

If I pull a phpinfo(); I can the server name under the Hostname:Port field under the apache2handler, so I know it's accessible somehow.

Josh K
  • 454
  • 1
  • 6
  • 18

1 Answers1

1

In PHP do a

var_dump($_SERVER);

or even

var_dump($_REQUEST);

Should help you. I have a feeling it is probably $_SERVER['HTTP_SERVER_NAME'] but do the above and it will tell you exactly

Wizzard
  • 342
  • 1
  • 4
  • 12
  • It's not in $_SERVER at all, I'll check $_REQUEST. – Josh K May 01 '10 at 03:02
  • Nope, nothing there either. This is similar to [this other question I found](http://serverfault.com/questions/44786/anyway-for-php-to-retrive-hostnameport-from-apache2handler) but the answer is unclear. – Josh K May 01 '10 at 03:03
  • And you can't use HTTP_HOST? – Wizzard May 01 '10 at 03:32
  • In your phpinfo() output scroll downto "Apache Environment" section, is there anything in there? – Wizzard May 01 '10 at 03:34
  • Yeah, fixed it. Had something to do with `UseConicalName` or something. – Josh K May 01 '10 at 04:09
  • So why'd you give the answer to me? You can answer yourself, so that way the person that comes along next will see your answer... – Wizzard May 01 '10 at 04:14