note 40561 added to reserved.variables
| From: | php at frambooz dot com | Date: | Mon, 08 Mar 2004 01:40:50 +0000 |
| Subject: | note 40561 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66413@lists.php.net to get a copy of this message | ||
If you want to dynamically set the $_SERVER["DOCUMENT_ROOT"] variable (which is nescessary
on IIS servers, for instance), try this bit of code (formatting added for clarity):
<?
$_SERVER["DOCUMENT_ROOT"] = str_replace(
$_SERVER["PATH_INFO"],
"",
ereg_replace(
"[\][\]",
"/",
$_SERVER["PATH_TRANSLATED"]
)
)."/";
?>
It will take the full path to the script, remove the path of the script relative to the web-root,
and formats it using forward slashes, UNIX style (C:/inetpub/... ).
Took a bunch of headaches away for me.
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40561
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40561&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40561&report=yes
Search -- http://master.php.net/manage/user-notes.php