From:             lampiluoto at gmail dot com
Operating system: Solaris10
PHP version:      5.2.0
PHP Bug Type:     *Directory/Filesystem functions
Bug description:  require and include fails to open file in current directory

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 bug report at http://bugs.php.net/?id=39351&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39351&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39351&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39351&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39351&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39351&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39351&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39351&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39351&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39351&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39351&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39351&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39351&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39351&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39351&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39351&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39351&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39351&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39351&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39351&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39351&r=mysqlcfg

Reply via email to