Fatal error: require_once () [function.require]: Unsuccessful opening required

I work in a php project, this gives an error like:

Warning:

require_once (ROOT_PATH / lib / confs / Conf.php) [function.require-once]: could not open the stream: there is no such file or directory in. \ htdocs \ GProject \ lib \ exception \ ExceptionHandler.php on line 20

Fatal error: require_once () [function.require]: Failed to open "ROOT_PATH / lib / confs / Conf.php" (include_path = '; C: \ php5 \ pear') in .. \ htdocs \ GProject \ lib \ exception \ ExceptionHandler.php on line 20

But in the file the \ExceptionHandler.php20th line

require_once ROOT_PATH . '/lib/confs/Conf.php';

And I have a Conf.php file under myself lib/confs/Conf.php, although I get an error message.

What could be the problem. Thanks in advance.

+5
source share
3

, ,

  • .
  • ROOT_PATH.
  • , , ROOT_PATH , .

, .

, PHP. :

  • , (,/usr/share/php).
  • set_include_path, ( get_include_path PATH_SEPARATOR).
+6

ROOT_PATH script. .

, .

if (defined('ROOT_PATH')) { echo 'Defined';} else { echo 'Not defined'; }

.

, , .

script.

define('ROOT_PATH',$_SERVER['DOCUMENT_ROOT']); //an example

, .

+2

Just echo the entire path you pass to the require_once function and carefully check to see if there is anything wrong with it:

echo ROOT_PATH . "/lib/confs/Conf.php";
+1
source

All Articles