Here is my code:
if (file_exists('config.php')) {
require('config.php'); // This is line 38
}
Which somehow produces the error:
Warning: require(config.php) [function.require]: failed to open stream: No such file or directory in /path/name/file.php on line 38
How on earth is this possible?
Update: The following does work:
if (file_exists(getcwd(). '/config.php')) {
require(getcwd(). '/config.php');
}
try to ignore the include path:
if it works you are missing . directory into the include path and you have to choose to include it or using relative path file names
You can change your include_path with a php configuration directive (if you can change the php config file) or resort to get_include_path() and set_include_path() on a per file/project base
ex:
set_include_path('.'. PATH_SEPARATOR . get_include_path());in your first line of php (or in a common configuration file);Sources: