title: Apache/PHP: Any way to retrieve the ServerName setting via PHP
body: <p>I have an Apache virtual host that looks like this:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName host1.example.com
      ServerAlias host2.example.com
      DocumentRoot /srv/web/host1.example.com/pub
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I have the following file:</p>
  
  <pre><code>/srv/web/host1.example.com/pub/test.php
  </code></pre>
  
  <p>I am requesting the following URL (notice that I am using the <code>ServerAlias</code>, not the <code>ServerName</code>:</p>
  
  <pre><code>http://host2.example.com/test.php
  </code></pre>
  
  <p>I'd like to have <code>test.php</code> output the <code>ServerName</code> variable somehow (<code>host1.example.com</code>). Is there any way to do that?</p>