What web server are you running? Are you using NTFS? PHP runs as the web
server (generally) so you have to make sure that user has permission to
access the file. If you're using IIS, it's the IUSR_<computer_name>
user. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -----Original Message-----
> From: Paul Kraus [mailto:[EMAIL PROTECTED]
> Sent: Sunday, April 06, 2003 11:32 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Permission issues with fopen on window xp pro.
> 
> I am working with chapter 10 in wrox Beginning php 4 book. I am
running
> my test system on windows XP pro.
> 
> I believe this error is due to a permissions setting. But when I look
at
> the properties for the default web page read write and scripts are all
> checked.
> 
> Error:
> Warning: fopen(./counter.dat) [function.fopen]: failed to create
stream:
> Permission denied in c:\inetpub\wwwroot\testing\counter.php on line 21
> 
> Code
> ----
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
>   <head>
>     <title>Simple Counter</title>
>   </head>
> 
>   <body>
>     <h1>Simple Counter</h1>
>     <hr>
>     <?php
>     //counter.php
>     $counter_file = "./counter.dat";
>     if(!($COUNTER = fopen($counter_file, "r"))) die ("Cannot open
> $counter_file.");
>     $counter = (int) fread($COUNTER, 20);
>     fclose ($COUNTER);
> 
>     $counter++;
> 
>     echo ( "You are visitor number $counter.");
> 
>     $COUNTER = fopen($counter_file, "w");
>     fwrite ($COUNTER, $counter_file);
>     fclose ( $COUNTER);
>     ?>
>     <address><a href="mailto:[EMAIL PROTECTED]"></a></address>
> <!-- Created: Sun Apr 06 10:35:34 Eastern Standard Time 2003 -->
> <!-- hhmts start -->
> Last modified: Sun Apr 06 11:01:02 Eastern Standard Time 2003
> <!-- hhmts end -->
>   </body>
> </html>
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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

Reply via email to