note 60987 added to function.require

From: Date: Sun, 22 Jan 2006 20:08:03 +0000
Subject: note 60987 added to function.require
Groups: php.notes 
Request: Send a blank email to php-notes+get-102246@lists.php.net to get a copy of this message
re: danielm at unb dot br... $_SERVER['DOCUMENT_ROOT'] is very useful, but it is not available with all web servers. Apache has it; IIS doesn't. I use the following to make my PHP applications work in more situations: <?php if (!defined("BASE_PATH")) define('BASE_PATH', isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : substr($_SERVER['PATH_TRANSLATED'],0, -1*strlen($_SERVER['SCRIPT_NAME']))); ?> ...but even that gets tripped up by symlinks to different mount points, etc. You could substitute realpath($_SERVER['PATH_TRANSLATED']), but that function has been reported not to work on some (Windows) servers. One could use the PATH_TRANSLATED for both servers, but I figure if Apache is going to tell me exactly what I want to know, I should listen. ---- Server IP: 64.71.164.2 Probable Submitter: 68.9.252.218 ---- Manual Page -- http://www.php.net/manual/en/function.require.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60987 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60987&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60987&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102246) next »