ID: 30437 User updated by: gabe at mudbuginfo dot com Reported By: gabe at mudbuginfo dot com -Status: Closed +Status: Open Bug Type: *Directory/Filesystem functions Operating System: linux 2.4.26 PHP Version: 4.3.9 New Comment:
Bug is different from 30881: This bug does not refer to the CLI SAPI, and refers to files from the include_path and not the current working directory. Prehaps the documentation should be updated to mention that when including a file in a parent directory (eg: '../blah.php'), paths within the include_path will not be searched. Previous Comments: ------------------------------------------------------------------------ [2004-11-27 16:46:11] [EMAIL PROTECTED] Same as #30881, which is already documented. ------------------------------------------------------------------------ [2004-10-14 22:22:51] gabe at mudbuginfo dot com Easier test case: Say for example, your include path is: /usr/local/lib/ php (most people have this or something similar) <?php echo "including normal DB\n"; include 'DB.php'; echo "including ../php DB\n"; include '../php/DB.php'; ?> The second include statement will fail with: including normal DB including ../php DB Warning: main(../php/DB.php): failed to open stream: No such file or directory in /tmp/x.php on line 5 Warning: main(): Failed opening '../php/DB.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/ local/lib/mis:/usr/local/lib/eclipse') in /tmp/x.php on line 5 ------------------------------------------------------------------------ [2004-10-14 22:06:53] gabe at mudbuginfo dot com Note, open_basedir is not set anywhere for this site. ------------------------------------------------------------------------ [2004-10-14 18:23:32] gabe at mudbuginfo dot com Description: ------------ This site prepends the full path to the site's directory for site-specific include files with the following code in the file /files/client/ global_fellowship_search/proto1/include/init.php $site_include_path = dirname(__FILE__); $sys_include_path = ini_get('include_path'); ini_set('include_path', $site_include_path . ':' . $sys_include_path); which creates an include path of '/files/ client/global_fellowship_search/proto1/include:.:/usr/ local/lib/php:/usr/local/lib/mis:/usr/local/lib/ eclipse' When attempting to include the file /files/ client/global_fellowship_search/proto1/mail/ forgot_pass.mail relative to the site's prepended include directory with "include_once '../mail/ forgot_pass.mail';", PHP fails to find the file. Supplying an absolute path to the file works. It just seems like PHP will not respect crawling up a '..' parent directory link for any path within the include_path except for '.' Note that this code was placed in the 'index2.php' file just for simplicity in demonstration; in implementation this inclusion code is held within another file in the include/ directory which is included several different directory levels. Reproduce code: --------------- (Within /files/client/ global_fellowship_search/proto1/index2.php) include_once '../mail/forgot_pass.mail'; Expected result: ---------------- Inclusion of /files/client/ global_fellowship_search/proto1/mail/forgot_pass.mail Actual result: -------------- Warning: main(../mail/forgot_pass.mail): failed to open stream: No such file or directory in /files/client/ global_fellowship_search/proto1/index2.php on line 5 Warning: main(): Failed opening '../mail/ forgot_pass.mail' for inclusion (include_path='/files/ client/global_fellowship_search/proto1/include:.:/usr/ local/lib/php:/usr/local/lib/mis:/usr/local/lib/ eclipse') in /files/client/global_fellowship_search/ proto1/index2.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30437&edit=1