|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-03-24 05:15 UTC] sniper@php.net
[2003-03-24 07:56 UTC] gallou at cict dot fr
[2003-03-24 10:37 UTC] magnus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 23:00:01 2025 UTC |
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?