January 29th, 2003, 09:22 AM
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.
January 29th, 2003, 09:33 AM
So you are able to initially open the file and write to it? Are you properly closing and releasing the file?
January 29th, 2003, 09:39 AM
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.
January 29th, 2003, 11:25 AM
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.
February 11th, 2003, 06:01 AM
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:
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.