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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux