Search code examples
phppermissionsmkdirunlink

PHP unlink() issues


Platform = Mac OS 10.8.5

Hi guys, I'm working on a php/mysql site. When I create a new user, my site creates a series of file folders to house information. My issue is when my user tries to delete his account, it will return a permissions error. I can temporarily fix this by changing the permissions of the biggest folder, but it all goes back to normal when I create a new user again. I am using XAMPP, which is located in the Mac Applications folder

This code:

unlink("Users/$clientUsername");

Returns this error:

Warning: unlink(Users/Admin): Operation not permitted in /Applications/XAMPP/xamppfiles/htdocs/POC-SQL/finalSite/deleteReciever.php on line 51

Any help is greatly appreciated.

Thanks


Solution

  • unlink — Deletes a file
    

    and

    rmdir() - Removes directory
    

    You have a directory. You need to use rmdir, not unlink.