Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

I am working in php project, its giving the error as:

Warning:

require_once(ROOT_PATH/lib/confs/Conf.php) [function.require-once]: failed to open stream: No such file or directory in ..\htdocs\GProject\lib\exception\ExceptionHandler.php on line 20

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

But in \ExceptionHandler.php file, the 20th line is

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

And I have the file Conf.php under the lib/confs/Conf.php itself, even though I am getting the error.

What may be the problem. Thanks in advance.

like image 367
Gnanendra Avatar asked Apr 13 '11 09:04

Gnanendra


1 Answers

I would go through the following assumptions debugging this,

  1. The file doesn't exist.
  2. The ROOT_PATH is incorrectly set.
  3. The current working directory isn't what is expected, so if ROOT_PATH is relative, it's breaking the full path.

If none of the above is the case, I'm not sure.

Some libraries must be installed into a directory that is listed in PHP's library path. In these situations you have a few options:

  • Install the library into a directory searched by PHP by default (e.g., /usr/share/php).
  • Update the include path using set_include_path without overwriting the old path (use get_include_path in combination with PATH_SEPARATOR).
like image 153
Stephen Melrose Avatar answered Nov 09 '22 21:11

Stephen Melrose