note 58960 added to reserved.variables
| From: | o-zone at siena dot linux dot it | Date: | Tue, 22 Nov 2005 12:37:16 +0000 |
| Subject: | note 58960 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98923@lists.php.net to get a copy of this message | ||
On IIS with PHP 4 we need to have something like a $_SERVER["DOCUMENT_ROOT"]. So i've
made this quick&dirty hack:
// By Michele "O-Zone" Pinassi
$pathInfo = explode('/',$_SERVER["PATH_INFO"]);
$pathTransl =
explode('/',str_replace('\\','/',$_SERVER["PATH_TRANSLATED"]));
$fNeedle = $pathInfo[1];
$docRoot = 'c:\\'; // First part of the path
for($c=1; $c<count($pathTransl) ;$c++) {
if($pathTransl[$c] == $fNeedle) {
break;
} else if(strlen($pathTransl[$c]) > 0) {
$docRoot .= $pathTransl[$c].'\\';
}
}
// at this point $docRoot contains our DOCUMENT_ROOT
echo '<b>'.$docRoot.'</b><br>';
Aloha ! Oz
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58960
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58960&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58960&report=yes
Search -- http://master.php.net/manage/user-notes.php