Jump to content

DOCUMENT_ROOT help needed


spires

Recommended Posts

Hi

 

I have this bit of code:

defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']);
defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');

 

That i'm using so all systems can always find my class and important files.

 

This works fine on on of my websites, but I have just moved it over to another website (exact setup & on same server) and it is not working!!!

 

 

I'm getting the error:

Warning: require_once(/includes/functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/a/d/adele/web/public_html/includes/initialize.php on line 9

 

Fatal error: require_once() [function.require]: Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/a/d/adele/web/public_html/includes/initialize.php on line 9

 

 

Basically, all my important files are in the initialize.php file. So I only need to call that one file on any of

my html pages.

 

 

I know it's DOCUMENT_ROOT, as when I remove this and link direct it works fine.

 

Thanks for any help

 

:)

 

 

 

Link to comment
Share on other sites

Yes:

 

initialize.php:

<?PHP

defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']);
defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');


require_once(LIB_PATH.DS."config.php");
require_once(LIB_PATH.DS."functions.php");


// core objects
require_once(LIB_PATH.DS."session.php");
require_once(LIB_PATH.DS."database.php");
require_once(LIB_PATH.DS."pagination.php");
require_once(LIB_PATH.DS."PHPMailer".DS."class.phpmailer.php");
require_once(LIB_PATH.DS."PHPMailer".DS."class.smtp.php");


// related classes
require_once(LIB_PATH.DS."profile_user.php");
require_once(LIB_PATH.DS."blog.php");
require_once(LIB_PATH.DS."blog_img_signup.php");
require_once(LIB_PATH.DS."blog_categories.php");



?>

 

 

In HTML file

require_once("../../../includes/initialize.php");

Link to comment
Share on other sites

Yes what? There is nothing there that puts any paths on your include path.

 

How about....

 

<?php

defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']);
defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');

set_include_path(get_include_path() . PATH_SEPARATOR . LIB_PATH);

require_once("config.php");
require_once("functions.php");


// core objects
require_once("session.php");
require_once("database.php");
require_once("pagination.php");
require_once("PHPMailer".DS."class.phpmailer.php");
require_once("PHPMailer".DS."class.smtp.php");

 

Then instead of....

 

require_once("../../../includes/initialize.php");

 

which should have been....

 

require_once(LIB_PATH.DS."initialize.php");

 

anyway shouldn't it?

 

You can now use....

 

require_once("initialize.php");

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.