note 22663 deleted from function.include by sniper
| From: | sniper@php.net | Date: | Wed, 29 Jan 2003 04:13:21 +0000 |
| Subject: | note 22663 deleted from function.include by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42988@lists.php.net to get a copy of this message | ||
you can add the following code to your auto_prepend_file to add the document root to the include
file:
-------------------------------------------------
// add docroot to include path
$old_path = ini_get('include_path');
$new_path = ereg_replace('\.:', ".:$_SERVER[DOCUMENT_ROOT]:", $old_path);
$new_path = ereg_replace('\.$', ".:$_SERVER[DOCUMENT_ROOT]", $new_path);
ini_set('include_path', $new_path);
-------------------------------------------------
then you can store include files in the document root (i use $docroot/etc for config and
$docroot/lib for functions). this directories can be protected via an .htaccess file, ie:
-------------------------------------------------
AuthName "null"
AuthType basic
AuthUserFile /dev/null
require valid-user
-------------------------------------------------
note that this will work with virtual hosts (each one gets its own include path).