I have this problem. We have a directory with includes, lets name it "/includes". include_path looks like this: ".:/includes", so it should first search in the current directory, yes?
Let's imagine we have a include file "includefile.php" in that directory, looking like this:
<?php
echo "I am the include file from include dir";
?>
Lets now imagine two scripts in two directories:
directory D1/index.php:
<?php
require_once('includefile.php');
?>
directory D2/index.php:
<?php
include('includefile.php');
?>
And now - lets put the include file also to this directory D2
directory D2/includefile.php:
<?php
echo "I am the include file from D2 dir";
?>
Now, lets assume we have cleared eAccelerator script cache. If we now invoke script in D2 in browser, we see the correct result. It will use the include file in the current path. Now, we invoke the script in D1. It will use the include file from /includes correctly.
But, now - if we invoke the script in D2 again, it will use the include file from /includes, ignoring the same named file in the current path completely, which is wrong! This situation lasts until the file /includes/includefile.php expires from the cache (like mtime of the file gets changed).
This bug appears only, if the first file is included with require_once() directive. Something bad happens to cache here? Also after this happens, only include() and require() directives works wrong, include_once() and require_once() are immune.
Workaround is to replace require() and include() by their xxxx_once() alternative when working like this, or use full paths. include('./includefile.php') works too.
Unfortunately we have a big app where we need to override some include files for some parts, so this bug caused our app randomly failing.
Of course this bug is not there when eAccelerator script caching is disabled.
Config: Apache 2.0.52, eAccelerator 0.9.5, PHP 5.1.6