Search code examples
phplinuxmkdir

How to delete Folders created with PHP mkdir?


I have created folders using PHP's mkdir command. Now I want to delete these folders over FTP or SSH.

I get the error "permission denied". I am on a managed server so I do not have root access.

What can I do so I will be able to delete these folders? Do I need to change the file permissions (chmod) using PHP?


Solution

  • The folders would have been created with the ownership/permissions of whatever account PHP was running under (Apache's, if you're doing this from a web-based script).

    You wouldn't be able to chown the directories to another account, as that requires root permissions. You could have the script that creates the directories set them to mode 0777, which'd give everyone read/write/delete access to them, but you might not want to open up things that wide.