Write permission denied for a file on IIS 5.1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gagandeepgupta16
    New Member
    • Feb 2007
    • 56

    #1

    Write permission denied for a file on IIS 5.1

    hi

    I need urgent help on this please....

    i am a newbie in PHP.
    i am using php on windows and IIS 5.1

    i am working on counter module for website...
    i have a text file that contains the count. what i have to do is read the count value from the file, add 1 and again write back to the file...

    the problem is as i execute the page on IE7 i am getting an error message:

    Warning: fopen(counter.t xt) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\wwwr oot\WebSite\fro nt.php on line 25

    this issue is when i open the file in 'w' write mode, whereas in 'r' read mode its working.

    search google for this issue and accordingly set permissions/security for everyone, iusr_machinenam e...

    i also tried creating virtual directory in iis and gave all permissions...


    the 'safe_mode...' is also set to 'off'

    still i am facing the same issue.

    thanks in advance
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    Make sure that the 'IUSR_<MachineN ame>' and the 'Network Service' users have proper permission on the directory / files you need you PHP to access.

    If that doesn't work, try giving 'Everybody' full access to the directory your file is in, have PHP create the file you need (delete the file and have PHP open the non-existing file with fopen), and the restore the previous permission on the directory.

    That should create a file with PHP's user as it's owner, which should give it full access to it. (In theory at least)

    If that doesn't work, I don't know. Windows is weird like that. That's why I use Linux ;)

    Comment

    • gagandeepgupta16
      New Member
      • Feb 2007
      • 56

      #3
      Originally posted by Atli
      Hi.

      Make sure that the 'IUSR_<MachineN ame>' and the 'Network Service' users have proper permission on the directory / files you need you PHP to access.

      If that doesn't work, try giving 'Everybody' full access to the directory your file is in, have PHP create the file you need (delete the file and have PHP open the non-existing file with fopen), and the restore the previous permission on the directory.

      That should create a file with PHP's user as it's owner, which should give it full access to it. (In theory at least)

      If that doesn't work, I don't know. Windows is weird like that. That's why I use Linux ;)
      hi,

      thanks for the reply...

      i already gave All permissions to Everyone, 'IUSR_<MachineN ame>' as i mentioned previous... but its not working.... :(

      but Atli...u rock!!!... when i deleted the file and left the application to create it on own its working...thank s a lot dude.

      thanks again

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Ahh ok. Glad it worked out tho :)

        Comment

        Working...