Results 1 to 4 of 4

Thread: file and directory permissions

  1. #1
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default file and directory permissions

    Hey there everyone. I have a question: I want to write a script that will write content to a file. Right now I have the directory that the file is in set at 0777 permissions and the file set at 0666 permissions. But I only want this script to be able to write to my file and my directory, not the whole world. Is there a way to do this? Perhaps to have the script identify a uid or gid or something? Thanks in advance.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You could use chown() to set the directory to the httpd user group (or whatever user "runs" the PHP script).

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    You could use chown() to set the directory to the httpd user group (or whatever user "runs" the PHP script).

    Hope this helps.
    It won't let me do this :-( It says I don't have permission.

  4. #4
    Join Date
    May 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I would like to know ho it's done too... I need to use the apache to allow me the record for the moment...

Bookmarks

Posting Permissions

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