PHP does have a defined procedure how to handle these includes and requires.
Files are included based on the file path given or, if none is given, the include_path
specified. If the file isn't found in the include_path
, include will finally check in the calling script's own directory and the current working directory before failing. [...]
If a path is defined — whether absolute (starting with a drive letter or \ on Windows, or / on Unix/Linux systems) or relative to the current directory (starting with . or ..) — the include_path
will be ignored altogether. For example, if a filename begins with ../, the parser will look in the parent directory to find the requested file.
Because you don't specified a path, the include_path is the first ressource the file will be searched. There are two entries by default in that include_path, first "." which is a representation for the current woring directory (which will be the file which gets requested and where all the other files get included to) and the second entry is PEAR and THERE you will find an config.php file too.
So it is not your file that gets included, but the PEAR file.
The root of your problem is, that you don't specify paths in your includes and requires. One solution that i have told you is using __DIR__ which is a representation of the Path the included file comes from.
So don't blame the name of the file, PEAR or someone else for that issue, it's you don't using require and include the way you should.