php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22842 Include problems under Solaris with 4.3.0
Submitted: 2003-03-24 03:47 UTC Modified: 2003-03-24 10:37 UTC
From: gallou at cict dot fr Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.3.0 OS: Solaris
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gallou at cict dot fr
New email:
PHP Version: OS:

 

 [2003-03-24 03:47 UTC] 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?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-24 07:56 UTC] gallou at cict dot fr
This new release (CVS build 200203241230, 4.3.2) fixes this problem. Thanks. 
Sorry for the disturbance, I should have tested the latest release...
 [2003-03-24 10:37 UTC] magnus@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

As user reports.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC