Re: Problem with the fwrite function (not as simple as it sounds though)

From: Date: Sun, 20 Nov 2005 10:44:08 +0000
Subject: Re: Problem with the fwrite function (not as simple as it sounds though)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-226148@lists.php.net to get a copy of this message
Hello again, here's some more extra info on my case that came out while Suhas Pharkute was helping me find a resolution: So the safe-mode is off, that's for sure, I turned it off at compile stage. I delete the file after each run of the script, the folder where the script is located has 777 permissions and the ownership is given to uid 1027 gid 1020, whereas these are the uid/gid set for apache to run with (and it does!). The script: $data="some data"; $file="file.txt"; $handle = fopen($file,"w"); fwrite($handle,$data); fflush($handle); fclose($handle); if (is_writable($file)) echo "Is writable<br>"; else echo "Isn't writable<br>"; works when I run it as root, from the shell (php script.php), but when it's run from the server, it doesn't. I mean, the output _IS_ in _BOTH_ cases "Is writable" but that doesn't change a thing, cause when executed from the apache, it just creates an empty file without content. The other thing I was supposed to check was stat($file); with clearstatcache(); called beforehand. The output of this is: device number: 777 inode number: 1142470 inode protection mode: 33188 number of links: 1 _userid_of_owner:_1027_ groupid of owner: 1020 device type, if inode device *: 0 _size_in_bytes:_0_ time of last access (Unix timestamp): 1132482491 time of last modification (Unix timestamp): 1132482505 time of last inode change (Unix timestamp): 1132482505 blocksize of filesystem IO *: 4096 _number_of_blocks_allocated:_0_ and of course when executed as root: device number: 777 inode number: 1142470 inode protection mode: 33188 number of links: 1 _userid_of_owner:_0_ groupid of owner: 1020 device type, if inode device *: 0 _size_in_bytes:_9_ time of last access (Unix timestamp): 1132482980 time of last modification (Unix timestamp): 1132482980 time of last inode change (Unix timestamp): 1132482980 blocksize of filesystem IO *: 4096 _number_of_blocks_allocated:_8_ Can anybody help me? -- Best wishes Łukasz Hejnak

« previous php.general (#226148) next »