In my local environment (PHP 5.4.24 on Apache 2.2.26) $_SERVER["SCRIPT_URL"]
is present, but I read around that this variable is not always present, even though I couldn't find exactly when it is and when it isn't.
I'd like to know what is required for this variable to be reliably present.
It's only available when you have mod_rewrite enabled:
http://httpd.apache.org/docs/2.0/rewrite/rewrite_intro.html#EnvVar