How to get the URL of the currently executing PHP script?
<p>How do I get the URL of the currently executing PHP script?</p>

<p>For example, the URL <code>http://www.domain.com/folder/script.php</code> sends a request to <code>/var/www/domain/folder/script.php</code>. </p>

<p>In <code>script.php</code>, I want to echo <code>http://www.domain.com/folder/</code> (not <code>/var/www/domain/folder/</code>, not <code>http://www.domain.com/folder/script.php</code>). What is the simplest way to do this?</p>
