ID: 39351 Updated by: [EMAIL PROTECTED] Reported By: lampiluoto at gmail dot com -Status: Open +Status: Feedback Bug Type: *Directory/Filesystem functions Operating System: Solaris10 PHP Version: 5.2.0 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2006-11-12 19:17:43] lampiluoto at gmail dot com Here is part of the truss output, I can provide the whole output if needed. After failing getcwd() 5.2.0 tries to open file with wrong path. # # PHP-5.1.6 # 662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0 662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14 662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES [file_dac_read] 662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0 662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES [file_dac_read] 662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14 662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES [file_dac_read] 662: open("./inc/config.php", O_RDONLY) = 17 662: fstat(17, 0x00783920) = 0 662: lseek(17, 0, SEEK_CUR) = 0 662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572 662: read(17, 0x0077F258, 8192) = 0 662: read(17, 0x0077F258, 8192) = 0 662: close(17) = 0 662: time() = 1163357246 # # PHP-5.2.0 # 17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0 17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14 17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES [file_dac_read] 17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0 17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES [file_dac_read] 17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14 17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES [file_dac_read] 17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT 17703: open("/data/logs/httpd/error_log-php", O_WRONLY|O_APPEND|O_CREAT,0666) = 17 17703: lseek(17, 0, SEEK_END) = 0 17703: time() = 1163358385 17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0 17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0 17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY 17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224 17703: close(17) = 0 ------------------------------------------------------------------------ [2006-11-11 22:57:10] [EMAIL PROTECTED] Would it be possible for you to get us an strace or truss of a 5.1.6 relative include and the same for a 5.2.0 one? I don't remember any getcwd() changes, but it sounds like there must have been one somewhere. ------------------------------------------------------------------------ [2006-11-02 22:38:02] lampiluoto at gmail dot com Description: ------------ I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code failed and produced errors as any require() or include() with relative path fails. With absolute path it's ok. The same code in same environment works fine on PHP 5.1.6. Reason might be that on Solaris getcwd() does not return current working directory unless user has read privileges from root directory to the current dir. Has something changed in 5.2.0 ? User running httpd does not have read privileges to every directory in Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to part of the directories. Reproduce code: --------------- // this fails on 5.2.0 but works fine on 5.1.6 require('config.php'); // this works also on 5.2.0 require('/absolute/path/to/config.php'); Expected result: ---------------- File config.inc should be read successfully. This require('config.php') works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same environment, it does not. Actual result: -------------- // with relative path [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning: require(config.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /path/to/index.php on line 3, referer: http://mysite/index.php [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required 'config.php' (include_path='.:/opt/httpd/php5/lib/php') in /path/to/index.php on line 3, referer: http://mysite/index.php ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39351&edit=1