#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    2
    Rep Power
    0

    Red face iis permission for php


    I'm attempting to create a very simple counter script. It opens the file and increments the count fine, but when I try to reopen the file to write the new count to it, I get a permission denied error.

    Warning: fopen("countlog.txt","r+") - Permission denied in c:\inetpub\wwwroot\future\count.php on line 15

    Line 15 is this: $fp = fopen("countlog.txt","r+");

    I've tried other flags with no difference. The server I'm publishing to is on our network, Win2000 with IIS5, and I have full administrator rights to it. When I look at the folder permissions tab, I have permission for everything (all boxes are checked). When I look at the file permissions tab, it is the same thing. That to me indicates that there should be no problem with me writing to the file. The text file was created just a few minutes ago in notepad, by me. So what could be the problem??? Does it have to be created by the PHP script instead? If so, any insight into how I should do this? I would write to a database if I could, but it isn't an option right now. PHP on Windows can be frustrating at times.

    thanks
    ken
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    No es importante
    Posts
    2,065
    Rep Power
    14
    Originally posted by kennyb
    It opens the file and increments the count fine, but when I try to reopen the file to write the new count to it, I get a permission denied error.

    Warning: fopen("countlog.txt","r+") - Permission denied in c:\inetpub\wwwroot\future\count.php on line 15

    Line 15 is this: $fp = fopen("countlog.txt","r+");

    So you are able to initially open the file and write to it? Are you properly closing and releasing the file?
    El éxito consiste en una serie de pequeñas victorias día a día

    MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    2
    Rep Power
    0

    reply


    no bud, it doesnt let me change the contents of the file at all, sorry for being unclear. it just wont let me open the file to work on the contents of it at all.
    ken
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2002
    Posts
    693
    Rep Power
    26
    Well, it doesn't matter what your permissions are. The webserver runs as the IUSER_[machine name] local user so that user must have access to the file.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    3
    Rep Power
    0
    i just been looking at http://www.php.net/manual/en/function.fopen.php

    the trouble could be in your php.ini if you are working in so-called safe-mode:

    http://www.php.net/manual/en/feature...#ini.safe-mode

    If you are experiencing problems with reading and writing to files and you're using the server module version of PHP, remember to make sure that the files and directories you're using are accessible to the server process.

    If you are attempting to create a file in a directory, first makes sure you have read/write permissions on that directory.
    If you do, check your apache config to make sure you are allowing directory write permissions.

IMN logo majestic logo threadwatch logo seochat tools logo