Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts

    Problem writing a file on XP with AD

    Ok, I've got the following line in my code...

    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?

  • #2
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    chomd it to 777
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #3
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    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.

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Have you tried chmod'ing the directory the file's to be created in to 777?

  • #5
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    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...

    Code:
    fopen("//server/share/dir/file.ext","w+");
    and it worked.

    NOTE: backslashes do NOT work.

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •