Get server path minus file name in PHP
<p>I have a PHP script I am writing that will be used on more than one server.  So it could be at any of these:</p>

<pre><code>/home/14535/domains/something.com/html/miller/test/index.php
/home/12345/domains/something.com/html/jones/test/dir4/index.php
/home/11112/domains/something.com/html/smith/test/test2/test3/index.html
</code></pre>

<p>in any above case in need to return the full path minus the index.php or index.html</p>

<p>How can I <strong>reliably</strong> return the full server path of the current directory MINUS the actual script name? (There will be some image uploading etc and that is why I need this path).</p>

<p>Thanks,
Chris</p>
