File Permissions in PHP

Discussion in 'PHP' started by Polizel, Jun 12, 2010.

  1. #1
    Hello,
    i am not sure if PHP is the best category to post this so sorry in advance.
    I am following a tutorial for learning PHP in which the instructor develops a Photo Gallery project. In a
    video instructor set / change / modify the file permission in MAC OS X using command line and makes a note that windows users can use PowerShell to do the same but when i enter the command i receive error. This is what the instructor does:
    1. display a list of files in btb_sandbox
    2. chown a file.
    3. chmod a file.
    and use posix library which i cant find any where..
    so i'll be very very grateful if any of u tell me what the exact command on windows are, i how can do this on windows, I am using Windows 7
    I can provide link of tutorial video if needed
     
    Last edited: Jun 12, 2010
    Polizel, Jun 12, 2010 IP
  2. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ANy help please! i just want to know powershell commands for chagning owner and file permission (0666 / 0777 ) of a file
     
    Polizel, Jun 12, 2010 IP
  3. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #3
    What tutorial is it!
    If CHMODing is the issue even you can do with PHP_FTP
     
    roopajyothi, Jun 12, 2010 IP
  4. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Polizel, Jun 12, 2010 IP
  5. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Link is included now i am still w8ing for some advices
     
    Polizel, Jun 13, 2010 IP
  6. kothinti

    kothinti Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Setting Permission

    [user@localhost]$ chown theuser thefilemask

    [user@localhost]$ ls -l

    rwx-w-r-- 4 php 4096
    Nov 7 15:52 mydirectory

    Modify the permissions in PHP

    [user@localhost]$ chmod 755 thefilemask

    Applying the permissions to the file in PHP

    [user@localhost]$ ls -l
    -rwx-w-r-- 4 php mygroup 4096 Nov 7 18:52 myfile
    [user@localhost]$ chmod 524 myfile
    [user@localhost]$ ls -l
    -r-x-w-r-- 4 php mygroup 4096 Nov 7 18:60 myfile
    [user@localhost]$
     
    kothinti, Jun 19, 2010 IP
  7. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #7
    What is this???
     
    roopajyothi, Jun 19, 2010 IP
  8. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #8
    Standard unix shell commands.....

    TO THE OP:

    Windows and unix file permissions are totally different; You almost always dont need to do this on a windows system but if you do it is a lot simpler; attrib will let you change read-only permissions, hidden etc (it can be done in explorer, but im not a windows person im afraid)

    WINDOWS:
    http://www.computerhope.com/attribhl.htm

    HOWEVER: You arent clear what you are doing. Is this a local setup or are you connecting to a remote server? If you are then you can easily change the file permissions through SSH (get putty for windows) using the same commands -OR- FTP (just right click the file, and choose permissions in most cases).

    If you are still stuck, please provide your exact setup and ill get you the answer.
     
    lukeg32, Jun 19, 2010 IP