I have 3 files: database.php, intialize.php and config.php. The 3 files are located under a folder named:
usr/loca/nginx/html/phpcode/php/999_projects/test/include/
database.php
<?php
echo "before";
require_once('initialize.php');
echo "after";
echo LIB_PATH;
?>
initialize.php
<?php
// DIRECTORY_SEPARATOR is a PHP pre-defined constant
// (\ for Windows, / for Unix)
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
defined('SITE_ROOT') ? null :
define('SITE_ROOT', $_SERVER["DOCUMENT_ROOT"].DS.'phpcode'.DS.'php'.DS.'999_projects'.DS.'test');
defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');
// load config file first
require_once(LIB_PATH.DS.'config.php');
?>
config.php
<?php
// Database Constants
defined('MYSQL_DSN') ? null : define("MYSQL_DSN", "mysql:host=localhost;dbname=talkback");
defined('DB_USER') ? null : define("DB_USER", "user");
defined('DB_PASS') ? null : define("DB_PASS", "pass");
?>
Once I run database.php, I get the following:
Warning: require_once(/usr/local/nginx/html/phpcode/php/999_projects/test/includes/config.php): failed to open stream: No such file or directory in /usr/local/nginx/html/phpcode/php/999_projects/test/include/initialize.php on line 16
AND
Fatal error: require_once(): Failed opening required '/usr/local/nginx/html/phpcode/php/999_projects/talkback/includes/config.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/local/nginx/html/phpcode/php/999_projects/talkback/include/initialize.php on line 16
The 3 files have the proper permissions and also the web server has permission to access these files.
I have tried for the past couple of hours (!) to fix it, however, I can`t find what am I missing.
Can someone please assist?
Thanks,
Qwerty