Directory creation problem

Discussion in 'PHP' started by Balamurali, Mar 27, 2008.

  1. #1
    Hai all, I am doing one project on that i have created the directory for upload the files, I have successfully create the directory using "mkdir" using 700 permission, the problem is i could not remove the directory and i could not remove the file in the particular directory from the server. anyone know what is the solution for this?
     
    Balamurali, Mar 27, 2008 IP
  2. mythbuster08

    mythbuster08 Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    "I" is not user account on most linux machines. what user account created the dir, what user account tries to delete the dir? is dir empty or not?
     
    mythbuster08, Mar 27, 2008 IP
  3. Balamurali

    Balamurali Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Actually my server is unix server, i am doing the project for university, once the admin enter the values and submit the values, the directory will be create with student name and two pdf file will be create one for mark and another for degree certificate that two pdf file will upload into the corresponding student directory,
    this is the process, all have been done successfully, but the problem is i could not remove the directory. I could not delete the empty directory too...
     
    Balamurali, Mar 27, 2008 IP
  4. mythbuster08

    mythbuster08 Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    u use rmdir and not rm? both creation and deletion is done with php? what error message you get?
     
    mythbuster08, Mar 27, 2008 IP
  5. Balamurali

    Balamurali Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I am not using rmdir, there is no process for rm dir, i have deleted manually, but it not been deleted. what can i do...
     
    Balamurali, Mar 27, 2008 IP
  6. mythbuster08

    mythbuster08 Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    manually means via ftp or ssh?
    your dir is created by user "wwwrun" or "apache" or somthing. with 700! then user "joe" or "ssh" or "ftp-joe" wants to delete it. sure this fails!
    error message is something with "no permission" ?
     
    mythbuster08, Mar 27, 2008 IP
  7. Balamurali

    Balamurali Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    yes of course i am using apache server. i have try to delete through filezilla, but the error message is Permission denied.
     
    Balamurali, Mar 27, 2008 IP
  8. mythbuster08

    mythbuster08 Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    no doubt. ftp-user and apache-php-user are not same. only the user that has created dir can delete it. chmod or chown. if not possible you must delete via apache-php. can use scripts like phpfilemanager from sourceforge.
     
    mythbuster08, Mar 27, 2008 IP
  9. Balamurali

    Balamurali Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks. I am not new in php, so could you please explain it more.
     
    Balamurali, Mar 27, 2008 IP
  10. mythbuster08

    mythbuster08 Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    epxlain what? *nix file permissions? check wiki for this.
    download phpfilemanager. upload to you docroot. delete folder.
    still can not understand why no rmdir in unix? other command to execute in php to remove a directory?
    exec("rmdir folder") no work? rmdir("folder") not work?
    if rmdir really not possible you must create file with 777
     
    mythbuster08, Mar 27, 2008 IP
  11. Balamurali

    Balamurali Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks Mr. mythbuster. could you explain ftp-user and apache-php-user.
     
    Balamurali, Mar 27, 2008 IP
  12. mythbuster08

    mythbuster08 Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    evrybody on unix has a userid. there are user ids that are used for certain application. normally the ftp-user has a user id that is different from the user id of apache. if php is run as apache module, files are created with the id of apache. if php is run as cgi the user id is different. most times it is same user id as ftp-user account uses.
     
    mythbuster08, Mar 27, 2008 IP