Hello! I am having a problem with my include system. The include system is a script that sets up the PHP include_path so that I do not have to juggle it around on a large website directory tree. Here is the code:
The original include_path is set to the config directory, so I have to set the base directory to be the root of my website. This is the reason for the dirname(dirname(_FILE_)). I include things as follows:
Every time I run a script including things like that, I get the failed to open stream or "No such file or directory" error. What is causing my problem and what can I do to fix it? I am running my test server on a Windows machine with Apache.
Cheers,
Matt
Code:
<?php
$_PATHS["base"] = dirname(dirname(__FILE__))."\\";
$_PATHS["config"] = $_PATHS["base"]."config";
$_PATHS["templates"] = $_PATHS["base"]."templates";
$_PATHS["encryption"] = $_PATHS["base"]."encryption";
$_PATHS["database"] = $_PATHS["base"]."database";
$_PATHS["Smarty"] = $_PATHS["base"]."Smarty";
$_PATHS["sessions"] = $_PATHS["base"]."sessions";
ini_set('include_path', "$_PATHS[templates];$_PATHS[encryption];$_PATHS[database];
$_PATHS[Smarty];$_PATHS[sessions]");
?>
The original include_path is set to the config directory, so I have to set the base directory to be the root of my website. This is the reason for the dirname(dirname(_FILE_)). I include things as follows:
Code:
require_once('paths.conf.php');
require_once('Smarty.class.php');
require_once('db.conf.php');
require_once('database_connect.class.php');
Every time I run a script including things like that, I get the failed to open stream or "No such file or directory" error. What is causing my problem and what can I do to fix it? I am running my test server on a Windows machine with Apache.
Cheers,
Matt