#21958 [Com]: fopen fails in safe mode

From: Date: Mon, 26 May 2003 14:34:28 +0000
Subject: #21958 [Com]: fopen fails in safe mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40444@lists.php.net to get a copy of this message
 ID:               21958
 Comment by:       ohp at pyrenet dot fr
 Reported By:      ct at swin dot edu dot au
 Status:           Verified
 Bug Type:         Filesystem function related
 Operating System: Tru64 UNIX 5.1A
 PHP Version:      4.3.2-dev 5.0.0-dev
 Assigned To:      wez
 New Comment:

The bug is still there with php-4.3.2RC4 as an apache 1.3.27 module.
This is on Unixware 7.

with safe_mode=Off, file creation succeeds,
with safe_mode=On, file creattion fails with "failed to open stream: no
such file or directory ..."

I've tried setting the dir 777, make it owned by apache UID.. Nothing
worked.

A truss of the apache server showed that the last syscall before failed
was a pathconf(filename,...) returning ENOENT
File didn't exist so it's normal.

Please help


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

[2003-04-23 13:57:22] patrick_cossette1 at uqtr dot ca

With AIX 4.3.3 and PHP 4.3.1.

With safe_mode on , I cannot create a file with neither touch nor fopen
nor mkdir. (With safe_mode off, the creation works).

Apache is running under user "web" and group "web".
I have the directory /web/hee_dev whose owner is web.web with
permissions rwxr-s---

I have the script testing.php located in that directory:

   <?
     $fp=fopen("filetocreate","w+");
   ?>

If the file "filetocreate" does not already exist, I get the following
error while executing the script:
 
           Warning: Unable to access filetocreate  
           in /web/hee_dev/testing.php on line 2

           Warning: fopen("filetocreate", "w+") - No such 
           file or directory in /web/hee_dev/testing.php on 
           line 2

If the file already exists, I can open it without any problem.


I had read somewhere in the bug database that this should be solved by
now, but with 4.3.1, it still produces this error.

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

[2003-04-01 11:29:19] ohp at pyrenet dot fr

I have the same problem on 4.2.3 and 4.3.1.
I noticed that making touch before fopen("xxx","w") creates the file so
fopen succeeds.

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

[2003-02-26 20:44:34] magnus@php.net

Using Tru64 UNIX 5.1.
Both 4.3.2-dev and 5.0.0-dev.

Tested with safe_mode on and trying to create a file in /tmp

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

[2003-02-26 01:06:15] ct at swin dot edu dot au

I have noticed that in safe_mode.c after the line that has
VCWD_REALPATH(filename, path); (Line 84 from CVS version) the value of
path is always NULL in Tru64 UNIX.  

The same code testing on Linux using CLI SAPI, path = correct value.

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

[2003-02-23 23:43:32] ct at swin dot edu dot au

The build from php4-STABLE-200302231230 still produces the same error.

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

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/21958

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



Thread (26 messages)

« previous php.bugs (#40444) next »