You are here: Re: [PHP] Problem with the fwrite function (not as simple as it sounds though) « PHP « IT news, forums, messages
Re: [PHP] Problem with the fwrite function (not as simple as it sounds though)

Posted by £ukasz Hejnak on 10/08/48 11:32

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

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация