Update:
The index.php file here:
/public_html/d/index.php
includes:
/public_html/d/core/source/class.File1.php
<
getcwd()
always returns the same path no matter what file it is located in ( on my system ). A Bug in my opinion.
( On my system ) PHP found another file in a path not specified in the include list or in the current directory. This is a bug in my opinion.
On my system, if you don't want to use absolute paths...the only way I've found to use relative paths is dirname(__FILE__);
to prepend where you want to go.
. or ./ prepending the file did not work either....
Are you using set_include_path anywhere in your app? Perhaps that could be the cause of your problem. By doing that you are specifying a list of directories where the require, include, fopen(), file(), readfile() and file_get_contents() functions look for files first.
As an alternative I suggest you define the absolute path to avoid problems.
Write this on your /public_html/d/core/source/class.File1.php
// This if you are using PHP >= 5.3
include(__DIR__ . '/class.File2.php');
// Or this if you dont have the magic constant __DIR__ available
include(dirname(__FILE__) . '/class.File2.php');
__FILE__
and __DIR__
are magic constants. __FILE__
is a constant that has the absulute path to that specific file. And __DIR__
is the absulte path to the directory where that file is. You can even test them by doing echo __FILE__;
or echo __DIR__;
You can read more about them here http://php.net/manual/en/language.constants.predefined.php
Have you tried including with a relative path?
include './class.File2.php';
Is class.File1.php itself included by some other script?