#32503 [Opn->Fbk]: fopen() in cwd: filename must start with ./ under safe mode

From: Date: Mon, 19 Dec 2005 08:11:23 +0000
Subject: #32503 [Opn->Fbk]: fopen() in cwd: filename must start with ./ under safe mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90645@lists.php.net to get a copy of this message
 ID:               32503
 Updated by:       sniper@php.net
 Reported By:      Bjorn dot Wiberg at its dot uu dot se
-Status:           Open
+Status:           Feedback
 Bug Type:         Safe Mode/open_basedir
 Operating System: IBM AIX 5.2.0.0 ML5
 PHP Version:      5CVS-2005-07-05
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip




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

[2005-07-05 10:21:38] Bjorn dot Wiberg at its dot uu dot se

(Thanks for fixing the mpm_common crash, that problem is gone now.)

With #define HAVE_BROKEN_GETCWD 1 in php_config.h, and having made sure
that the path up to the directory where the file is to be created has
sufficient permissions, I still get the same error:

/apache/htdocs/bwiberg/test/safemode
Warning: fopen(): Unable to access a.txt in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning:
fopen(a.txt): failed to open stream: No such file or directory in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 

Having the read (r) permission off for the "test" directory along the
way:

Warning: fopen(): open_basedir restriction in effect. File(a.txt) is
not within the allowed path(s):
(.:/apache/php/lib/php/:/apache/htdocs/bwiberg/) in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning:
fopen(a.txt): failed to open stream: Not owner in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5

Best regards,
Björn

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

[2005-05-09 14:15:53] Bjorn dot Wiberg at its dot uu dot se

Hi again!

I just tried the #define HAVE_BROKEN_GETCWD 1 trick from
http://bugs.php.net/bug.php?id=32501, with PHP
5.0.4 (the "fixed"
version) but that didn't help in this regard. I thought I would mention
this.

Best regards,
Björn

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

[2005-04-05 09:28:28] Bjorn dot Wiberg at its dot uu dot se

Hi Tony!

Thank you for your feedback!

I'm afraid that absolute paths aren't a very viable solution to this,
as that probably would break too many scripts, expecting it to be
possible to "just" save a file to the current directory.

Is the "PHP realpath hack" supposed to handle these kind of problems on
AIX?

Please let me know if I can help in any way!

Best regards,
Björn

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

[2005-04-04 17:11:05] tony2001@php.net

Right, this is somehow concerned with broken realpath() on AIX.
The problem is that we end up with relative path in php_checkuid_ex()
function and it fails to check permissions for the directory.
Of course, the easiest solution is to use absolute paths everywhere.


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

[2005-04-01 16:32:32] Bjorn dot Wiberg at its dot uu dot se

Tried php5-200503310630 (5.1.0-dev), but the problem is still present:

/apache/htdocs/bwiberg/test/safemode
Warning: fopen(): Unable to access a.txt in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5 Warning:
fopen(a.txt): failed to open stream: No such file or directory in
/apache/htdocs/bwiberg/test/safemode/write.php on line 5

(Whereas "./a.txt" works just fine.)

Best regards,
Björn

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/32503

-- 
Edit this bug report at http://bugs.php.net/?id=32503&edit=1


Thread (22 messages)

« previous php.bugs (#90645) next »