Does "everyone" have modify/write permissions to this file? The first error it posts, is that it doesn't
have permissions to alter the file. This would also account for it failing to create the stream.
~Steve
Ron Stephenson wrote:
I'm trying to learn PHP and I have it loaded on my PC with XP pro and IIS 5.1. I run the following script and receive the error below. //hit_counter1.php $counter_file = "./count.txt"; if(!($fp = fopen($counter_file, "r"))) die ("Cannot open $counter_file."); $counter = (int) fread($fp, 20); fclose($fp);
$counter++;
echo "You're visitor No. $counter.";
$fp = fopen($counter_file, "w"); fwrite($fp, $counter); fclose($fp);
When run I get this error:
You're visitor No. 126. Warning: fopen(./count.txt) [function.fopen]: failed to create stream: Permission denied in c:\inetpub\wwwroot\hit_counter1.php on line 12
Warning: fwrite(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\hit_counter1.php on line 13
Warning: fclose(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\hit_counter1.php on line 14
I though I had set all necessary permissions but I seem to have missed something. Can someone help? I have been to numerous newsgroups and no one has been able to figure it out. I know it is something I'm doing wrong.
Ron
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php