From: gallou at cict dot fr Operating system: Solaris PHP version: 4.3.0 PHP Bug Type: Feature/Change Request Bug description: Include problems under Solaris with 4.3.0
Hi, I manage a web server with many hosted virtual servers. I am experiencing problems with includes in PHP 4.3.0 under Solaris, and I can't upgrade my server from 4.2.1. Most errors are with PHP codes which include things from the parent directory (..), which is in 'include_path'. Look at this test: tests/ |- inc |- inc.txt include OK |- mydir/ |- testinclude.php <? echo 'getcwd:', getcwd(), <BR>'; include ('inc/inc.txt'); ?> I have two httpd working, with the same config file except the port number (the server on 8088 loads the 4.3.0 version of libphp.so). Safe_mode is off. Include_path is '.:../:../../' for 4.2.1. With PHP 4.2.1, <http//my.server.com/tests/mydir/testinclude.php> works OK. With 4.3.0, <http//my.server.com:8088/tests/mydir/testinclude.php> gives: Failed opening 'inc/inc.txt' for inclusion (include_path='.:../:/usr/local/php-4.3.0/lib/php') in /usr/local/www/docs/www/tests/mydir/testinclude.php on line 2 This seems related to a change of PHP using getcwd() in this version (I guess). In this case, getcwd() returns nothing, since a directory is -rwx--x--x. This is the case for most virtual server document roots. Unlike Linux, on Solaris, getcwd() needs "r" access to _all_ directories of the path, otherwise you get (from "man getcwd"): EACCES A parent directory cannot be read to get its name. (It's not a bug, but a feature; seems strange to me). "include '../inc/inc.txt'" does not work either. Apart using full pathnames in includes, the only way I found to get it work in PHP 4.3.0 is "chmod o+r" every component of the dir path (this way, getcwd() returns the right value, and include works). It looks like PHP 4.3.0 resolves the pathname itself, using getcwd(). Due to this feature of Solaris, in my opinion, it's not a good idea to rely on this function to get a real pathname. This does not affect Solaris alone, but any system where getcwd() needs "r" access, that is HP/UX, Irix, and, I think, most unixes. I can't state this is a bug of PHP. But I can't upgrade my server. I posted a message in php.install which remains unanswered. I can't tell the webmasters to "chmod o+r" their directories or change their PHP codes. What else can I do to be able to upgrade my server? -- Edit bug report at http://bugs.php.net/?id=22842&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22842&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22842&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22842&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22842&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22842&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22842&r=support Expected behavior: http://bugs.php.net/fix.php?id=22842&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22842&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22842&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22842&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22842&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22842&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22842&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22842&r=gnused