php failed to open stream: No such file or directory -
i have 3 files: database.php, intialize.php , config.php. 3 files located under 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 php pre-defined constant // (\ windows, / 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 run database.php, following:
warning: require_once(/usr/local/nginx/html/phpcode/php/999_projects/test/includes/config.php): failed 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 proper permissions , web server has permission access these files.
i have tried past couple of hours (!) fix it, however, can`t find missing.
can please assist?
thanks,
qwerty
i think because have written this:
define('lib_path', site_root.ds.'includes');
... whereas in fact meant write this, without 's':
define('lib_path', site_root.ds.'include');
i'm inferring last bit of each of errors - seems file these other 2 being included lives in 'include' rather 'includes' directory?
/usr/local/nginx/html/phpcode/php/999_projects/talkback/include/initialize.php on line 16
Comments
Post a Comment