note 40560 deleted from reserved.variables by kennyt

From: Date: Mon, 08 Mar 2004 02:16:24 +0000
Subject: note 40560 deleted from reserved.variables by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66416@lists.php.net to get a copy of this message
Note Submitter: php@frambooz.com ---- 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.

« previous php.notes (#66416) next »