note 21672 deleted from function.require by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 00:44:15 +0000 |
| Subject: | note 21672 deleted from function.require by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59810@lists.php.net to get a copy of this message | ||
Note Submitter: sbeam@syxyz.net
----
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.