
Originally Posted by
kduv
If you want to include something from "one level up" you would use "../". If you use "/" then it will look in the root of your servers HDD.
Not quiet. It will look in the Document_Root of your website. Not the root of your HDD.
start your php script with:
PHP Code:
$path = '/absolute/path/to/document/root/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
and do your includes like this:
PHP Code:
include('includes/functions.php');
assuming that 'includes' folder is in the root dir from $path
You might as well do this:
PHP Code:
$path = '/absolute/path/to/document/root/'.PATH_SEPARATOR.'/absolute/path/to/document/root/includes/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
and include like this:
PHP Code:
include('functions.php');
No more headbreaking ../../blabla/somescript.php or things like that.
Look in the php manual for the set_include_path() function.
Bookmarks