#27382 [Opn->Csd]: fopen() does no longer create non-existant files when issued with "w"

From: Date: Tue, 24 Feb 2004 18:36:39 +0000
Subject: #27382 [Opn->Csd]: fopen() does no longer create non-existant files when issued with "w"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55470@lists.php.net to get a copy of this message
ID: 27382 Updated by: pgod@php.net Reported By: pgod@php.net -Status: Open +Status: Closed Bug Type: Filesystem function related Operating System: Linux 2.4.25 PHP Version: 4.3.4 New Comment: Ok, have found the reason. My Apache was configured as follows: User wwwadmin Group "#-1" That causes the files fopen wants to open to be created with user "wwwadmin" and group - well, here is the point where both kernels differed. Under 2.4.25 it is "65535", but the same file under 2.4.10 has a much higher gid, like "478238223" (not exactly, but something that big, cannot check now). Well, I changed the configuration to: User wwwadmin Group wwwadmin and now it works well under both kernels. Sorry this is not really a PHP bug, but as this 'Group "#-1"' thing is the default on many Apaches, maybe it is still helpful to some people. Previous Comments: ------------------------------------------------------------------------ [2004-02-24 13:27:07] pgod@php.net Description: ------------ I just switched linux kernels from 2.4.10 to 2.4.25, and now a script like this: <?php $fp = fopen("./test.txt", "w"); fputs($fp, "lalala"); fclose($fp); ?> tells me: Warning: fopen(./test.txt): failed to open stream: Invalid argument in /var/wwwroot/test.php on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /var/wwwroot/test.php on line 4 Warning: fclose(): supplied argument is not a valid stream resource in /var/wwwroot/test.php on line 5 I then switched from PHP 4.3.1 to 4.3.4, with the same result. Apache ist 1.3.27. Ran smooth since month. Apache process runs as user "wwwadmin", creating the file via commandline with "touch ./test.txt" works. Safe mode definitifely not enabled. No error messages in Apache error log or system logs. When I create the file on the command line, the error does not occur and fopen() works as expected. When I boot with Linux kernel 2.4.10, the error does not occur. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27382&edit=1

« previous php.bugs (#55470) next »