ID:               22842
 User updated by:  gallou at cict dot fr
 Reported By:      gallou at cict dot fr
-Status:           Feedback
+Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Solaris
 PHP Version:      4.3.0
 New Comment:

This new release (CVS build 200203241230, 4.3.2) fixes this problem.
Thanks. 
Sorry for the disturbance, I should have tested the latest release...


Previous Comments:
------------------------------------------------------------------------

[2003-03-24 05:15:20] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip



------------------------------------------------------------------------

[2003-03-24 03:47:25] gallou at cict dot fr

    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 this bug report at http://bugs.php.net/?id=22842&edit=1

Reply via email to