Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP include system failing

Status
Not open for further replies.

MJAZ

Programmer
Aug 1, 2006
73
US
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:

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top