PHP parses the include_path
in order of precedence. This means that when a relative path is passed to require()
, include()
, fopen()
, file()
, readfile()
or file_get_contents()
, PHP will start looking in the first directory. If the file is found, it includes it. If not, it will continue to the next and repeats the process.
Consider the following include path:
include_path = ".:/php/includes:/php/pear"
and the following PHP script:
<?php
require('MyFile.php');
PHP will look for MyFile.php
in the following order:
./MyFile.php
(Current Directory)
/php/includes/MyFile.php
/php/pear/MyFile.php
The reason why you cannot load Validate.php
is you already have a file called validate.php
(remember, paths are not case-sensitive on Windows, but are on UNIX) in your current directory. Therefore, PHP includes your file instead of the file corresponding to PEAR::Validate
since yours is found before PEAR's in the include_path
order of precedence.
Simply renaming your file to something else than validate.php
should fix your problem. If it still doesn't work, try echoing the return value of get_include_path()
to make sure it really is set right.