phpinclude-pathautoloadercwd

Is it possible to exclude '.' (ie. current dir) from PHP's include path?


From perusing the comments at http://php.net/manual/en/function.set-include-path.php , it seems to me that '.', or rather basename(__FILE__), is always implicitly added to PHP's include path. Is it at all possible to bypass this path?

In my work I'm using my own includer and class loader and I'd like to control the behavior of PHP's include(). My includer used to enforce absolute paths but I think this is really too restrictive, and I wouldn't want to revert to that. I'd like to work with PHP's include_path, if at all possible.


Solution

  • It's not possible. Says so in the documentation of include(): "... include() will finally check in the calling script's own directory and the current working directory before failing"