File permissions, created by PHP script - unable to delete through FTP!!!

Discussion in 'Site & Server Administration' started by szz, Jul 22, 2006.

  1. #1
    I create file or folder in my PHP script using permission masks 0777:
    
    mkdir($dir, 0777);
    // or 
    chmod($filename, 0777);
    
    PHP:
    Actually it means that these files are accessible/deleteable by everybody.

    But when I try to delete them through FTP - I can't!

    I have wasted 2 days trying to fix it...
    Who can explain it?!
     
    szz, Jul 22, 2006 IP
  2. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you post the permissions of the problems files, as they appear through FTP? Check the owner of the files too, as they'll probably be owned by 'nobody' rather than you. Oh, and also look at the owner and permissions of the parent directory that they are stored in.

    Cryo.
     
    Cryogenius, Jul 22, 2006 IP
  3. DrMalloc

    DrMalloc Peon

    Messages:
    130
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Cryogenius makes a good point. The server probably is running apache, which would use apache/nobody/www as the user unless SuEXEC is enabled (usually not). PHP has a chown function for changing the ownership of the file to you (as opposed to the web user, which only needs read/exec privileges), and if you still have trouble you could use php to remove the files and reupload using your ftp user.
     
    DrMalloc, Jul 22, 2006 IP
  4. szz

    szz Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, I know about chown, but to change it I need to know ftp user name?
    Seems like yes.
    OK, thanks to everyone!
     
    szz, Jul 22, 2006 IP
  5. jalex

    jalex Active Member

    Messages:
    184
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5
    run
    chown ftpuser filepath
    PHP:
    from line command and then try again
     
    jalex, Jul 23, 2006 IP