...

View Full Version : Problem writing a file on XP with AD



bcarl314
11-04-2003, 07:17 PM
Ok, I've got the following line in my code...



$fh = fopen($file,"w+");


Which gives me the following error...

Warning: fopen(./mqotd.rss) [function.fopen]: failed to create stream: Permission denied in D:\WebPub\includes\rssFeed.php on line 58


I'm guessing it's a permssions problem where the server isn't allowed to write to the directory. How do I set the permissions to write the file as me and not the web server?

SDP2006
11-04-2003, 09:11 PM
chomd it to 777

bcarl314
11-04-2003, 09:26 PM
I would, however, in order to chmod, I need to create the file first. (Or at least I thought I did)
Yep, still get the same error.

Nightfire
11-04-2003, 09:51 PM
Have you tried chmod'ing the directory the file's to be created in to 777?

bcarl314
11-05-2003, 03:23 PM
Well, I figured it out.

I was trying to access (write and create) a file on a network drive which is mapped on my box but not on the server.

So I changed the code to use the absolute path instead using UNC naming conventions...



fopen("//server/share/dir/file.ext","w+");


and it worked.

NOTE: backslashes do NOT work.

Nightfire
11-05-2003, 03:25 PM
heh, glad you got it fixed, I also just noticed that you're on xp and not unix, so chmod'ing went straight out the window there lol



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum