note 40563 added to reserved.variables

From: Date: Mon, 08 Mar 2004 01:43:06 +0000
Subject: note 40563 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-66415@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 server-path to the script ($_SERVER["PATH_INFO"]), removes the path to the script relative to the web-root ($_SERVER["PATH_TRANSLATED"]) and formats it using forward slashes (C:/inetpub/...) which will work on both unix and windows systems. 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+40563 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40563&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40563&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66415) next »