note 55475 added to reserved.variables
| From: | AngelinaBell at osu1 dot php dot net | Date: | Thu, 04 Aug 2005 15:55:20 +0000 |
| Subject: | note 55475 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93077@lists.php.net to get a copy of this message | ||
Warning:
$_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME'] may not always be set
correctly.
Some web hosts implement php as a CGI in such a way that they can turn it on or off for each virtual
domain. Several $_SERVER and $_ENV variable values may be incorrect for documents in subdirectory
subdomains of these virtual domains.
An include-file function or constant, instead of PHP_SELF or some other predefined variable
throughout a website, will make it easier to "fix" an entire website in case something
changes.
<?php
function true_url_path() {
// Pick the predefined variable that works on your server
return $_ENV['SCRIPT_URL'];
}
?>
Or
<?php
// Pick the predefined variable that works on your server
define("TRUE_URL_PATH", $_ENV['SCRIPT_URL']);
?>
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55475
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55475&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55475&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55475&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55475&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55475&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55475&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55475&report=yes
Search -- http://master.php.net/manage/user-notes.php