PHP get website root absolute URL in server?
<p>I rely heavily in <code>$_SERVER["DOCUMENT_ROOT"]</code> to get absolute paths. However this doesn't work for sites which URLs don't point to the root.</p>

<p>I have sites stored in folders such as:</p>

<ul>
<li>site1</li>
<li>site2</li>
</ul>

<p>all directly inside the root. Is there a way to get the path in the server where the current site root is?</p>

<p>It should return:</p>

<pre><code>   /var/chroot/home/content/02/6945202/html/site1 // If the site is stored in folder 'site1'
   /var/chroot/home/content/02/6945202/html // If the site is stored in the root
</code></pre>
