Write file can't work ?!? :-(
| From: | Ivan Mareni� | Date: | Sun, 17 Nov 2002 19:47:57 +0000 |
| Subject: | Write file can't work ?!? :-( | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-124811@lists.php.net to get a copy of this message | ||
Hi.
I am trying to create little counter:
I can't open file for writing.
I've tried different params: "w", "r+", "wb" ... nothnig works
I am using IIS 5.0 , and I have set permitions to read & write files on
server.
============= source code ===============
if(is_writable("counter.txt")==TRUE)
echo "File is writable";
else
echo "File is NOT writable";
echo "<br>";
$fd = fopen ("counter.txt", "r");
$my_count=0;
while (!feof ($fd)) {
$my_count = fgets($fd, 4096);
}
fclose ($fd);
$fd = fopen ("counter.txt", "wb");
if($fd==TRUE)
{
$my_count++;
fputs($fd, $my_count);
fclose ($fd);
}
echo "Your are user no:";
echo $my_count;
============= end source ================
but after execution PHP says that:
File is writable
Warning: fopen("counter.txt", "wb") - Permission denied in
c:\inetpub\wwwroot\PSK\user_no.php on line 27
Your are user no:8
Whay can't I open file for writing???
Thanks for help!!!