I'm following a tutorial for creating an instantiate file with the required files. This is the project tree:
and this is my instantiate.php
:
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
defined('SITE_ROOT') ? null : define('SITE_ROOT', DS.'var'.DS.'www'.DS.'html'.DS.'photo_gallery');
defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');
//load config file first
require_once(LIB_PATH.DS."config.php");
//load basic functions next so that everything after can use them
require_once(LIB_PATH.DS."functions.php");
//load core objects
require_once(LIB_PATH.DS."session.php");
require_once(LIB_PATH.DS."database.php");
//load database-related classes
require_once(LIB_PATH.DS."user.php");
In login.php
, I am requiring the initialize file as:
require_once("../../includes/initialize.php");
But following the tutorial, I could use the LIB_PATH
in files such as database.php
that requires config.php
and on user.php
requiring database.php
.
At the moment, they require the file, without path, as they are located in the same includes file. However, if I've understood all right the way directory separator, site root and lib_path works, it's to improve that, to don't need to add different paths everywhere, just add the path through the constants. Well, it doesn't work! It displays this: (on top you're seeing the echo of the dirname(__FILE__)
in the index.php
on the public folder.
I've checked the phpinfo
to see the root path... and everything seems alright, but not working if I try to use this LIB_PATH.DS
.
Last thing I've read about it's some ibay restrictions, but I've tried to do more research and I can't even find what this "ibay" is.
Does anyone knows why this is happening? Thank you!