fopen working for r mode but not for a and w mode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rakeshgouru
Forum Newbie
Posts: 5
Joined: Thu May 03, 2007 9:56 am

fopen working for r mode but not for a and w mode

Post by rakeshgouru »

I Just Installed the php 5.0.4 and mysql, i tested the phpinfo(); and its working fine. But when i used the function fopen in read mode its working fine but my php is not working for append mode and write mode, i couldnot understand the problem. The error message is as following :

Warning: fopen(test.txt) [function.fopen]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\test\test.php on line 2


Can anyone help me Thanks in advance.
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Post by guitarlvr »

The user which is trying to open the file has read permission and not write. It looks like your using MS IIS as your webserver. See what kind of permissions IUSR_{servername} has and if it has read make sure if has read/write/modify at least.

Wayne
rakeshgouru
Forum Newbie
Posts: 5
Joined: Thu May 03, 2007 9:56 am

Thanks Wayne

Post by rakeshgouru »

Yes my webserver is MS IIS, how could i set permissions IUSR_{ servername } as read/write/modify.

[s]Plz[/s] please Guide me Wayne.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Post by guitarlvr »

You'll right click on your wwwroot directory, select properties and then security from the tabs at the top. One of the users in the list should be internet guest account. highlight that user and make sure he has "read and execute", "modify", "read", and "write". I usually give him full control but you dont have to. You will probably want to click on the advanced button in that window and check the box that says replace permission entries on all child objects. Try that out and let me know what happens.

Wayne
rakeshgouru
Forum Newbie
Posts: 5
Joined: Thu May 03, 2007 9:56 am

Thank You

Post by rakeshgouru »

Thank You very much Wayne, My problem solved. I done as per your instructions and now its working fine for both append mode and write mode.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

MMMM Full control on an IIS server...
Post Reply