#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Melbourne - Australia
    Posts
    35
    Rep Power
    11

    Permission to write files in wwwroot


    Using PHP 4.3.4 with IIS 5.1, I am trying to open a file for write access in wwwroot:
    Code:
    <?php
    $handle=fopen("msg.txt","wb");
    
    fclose($handle);
    ?>
    The code flags an error on running the script, claiming that I don't have permission:
    Warning: fopen(msg.txt): failed to open stream: Permission denied in e:\inetpub\wwwroot\post.php on line 6
    I went to the IIS control panel, Default Web Site properties, Home Directory, and ticked the Write access box. I restarted and still get the same error. Is there another permission I have to modify?
    Ben Forbes
    Windows XP Professional
    MS Visual Studio .NET
    1.53 ghz Athlon XP
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Melbourne - Australia
    Posts
    35
    Rep Power
    11
    Don't worry, I worked it out. I had to tweak the actual folder security settings in Explorer, for wwwroot. Administrators had full access, but users didn't, which implies that a PHP script doesn't run as an administrator, but a user. Is that correct?

    BTW, I was always logged in as an administrator.
    Ben Forbes
    Windows XP Professional
    MS Visual Studio .NET
    1.53 ghz Athlon XP
  4. #3
  5. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,428
    Rep Power
    4539
    By default IIS runs under the IUSR_computername local user account when it's servicing anonymous web users. If your site forces user authentication, IIS will impersonate the logged-in user.

    The server administrator can change the default IIS user account.

IMN logo majestic logo threadwatch logo seochat tools logo