note 21672 added to function.require

From: Date: Wed, 22 May 2002 16:57:09 +0000
Subject: note 21672 added to function.require
Groups: php.notes 
Request: Send a blank email to php-notes+get-30912@lists.php.net to get a copy of this message
rather than messing with $DOCUMENT_ROOT, relative paths and all that headache-inducing stuff, use php's 'include_path' configuration directive to get your require()'ds working without any fuss: -make a directory outside your web root for your files to be required()/included(). -if you use Apache, put in a .htaccess file in your top-level web dir the line php_value include_path /path/to/your/new/include/dir (make it absolute) if you use another web server you could edit the "include_path" directive in php.ini (if you use pear or other 3rd-party libs, make sure the paths to those are also in your include_path, separated with colons) thats it. now you can require("some_file.php"); from anywhere in your filesystem. php knows where to look for it. -- http://www.php.net/manual/en/function.require.php http://master.php.net/manage/user-notes.php?action=edit+21672 http://master.php.net/manage/user-notes.php?action=delete+21672 http://master.php.net/manage/user-notes.php?action=reject+21672

« previous php.notes (#30912) next »