I'm having issues with includes when the included file itself includes another file but refers to it with the dot prefix. For example there are three files - inc1.php, inc2.php, and subdir/test.php, the contents of which are -
subdir/test.php:
set_include_path(get_include_path().":../:../.");
require("inc1.php");
inc1.php:
require("./inc2.php");
inc2.php
echo "OK";
This include tree shown here fails with a failed to open stream: No such file or directory error. It works if inc1.php contains a simple require("inc2.php");, without the "./" prefix. I added "../." to the include path as an attempt to get it to work, but that had no effect.
Other than performing the include with the "./" prefix, what is the solution here, assuming that inc1.php and inc2.php are not writable and you can only alter subdir/test.php? How can you still include inc1.php from within test.php?
For reference, I'm using PHP 5.2.9.