note 28319 added to function.fopen

From: Date: Thu, 09 Jan 2003 06:43:44 +0000
Subject: note 28319 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-41889@lists.php.net to get a copy of this message
I'm a newbie to to php and i'm having trouble understanding why i'm getting errors from my local machine (xp pro IIS 5.0) utilizing the fopen(), fwrite(), and fclose() functions. But, when i upload it live to my ISP it works flawless! here's my code and the errors that are being thrown: I hope some one can HELP! It gets confusing when trying to learn this stuff! <?php $counter_file = "./count.dat"; 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 ", date("h:i, jS F"); $fp = fopen($counter_file, "w"); fwrite($fp, $counter); fclose($fp); ?> Warning: fopen(./count.dat) [function.fopen]: failed to create stream: Permission denied in c:\inetpub\wwwroot\struc1\php\hit_counter1.php on line 21 Warning: fwrite(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\struc1\php\hit_counter1.php on line 22 Warning: fclose(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\struc1\php\hit_counter1.php on line 23 -- http://www.php.net/manual/en/function.fopen.php http://master.php.net/manage/user-notes.php?action=edit+28319 http://master.php.net/manage/user-notes.php?action=delete+28319 http://master.php.net/manage/user-notes.php?action=reject+28319

« previous php.notes (#41889) next »