note 58960 deleted from reserved.variables by mazzanet
| From: | mazzanet@php.net | Date: | Sun, 25 Dec 2005 23:37:53 +0000 |
| Subject: | note 58960 deleted from reserved.variables by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100703@lists.php.net to get a copy of this message | ||
Note Submitter: o-zone at siena dot linux dot it
----
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