mickyginger — 2011-05-26T12:34:01-04:00 — #1
A project I'm working on at the moment requires me to delete files and folders on the server.
I'm testing it locally at the moment, and I'm running into a couple of problems.
Firstly, even though the subfolder and the files have their permissions set to 0777, I get the error message:
Warning: unlink(/Users/mickyginger/Sites/galleries/Cradles/index.php) [function.unlink]: Permission denied in /Users/mickyginger/Sites/includes/helpers.inc.php on line 20
Secondly, and more worryingly, as I'm using a mac I have a hidden file .ds_store in every folder, which is created by mac os x, which also cannot be deleted, because of permission settings.
Can anyone shed some light on the best practice for the creation and deletion of files and folders with php.
mickyginger — 2011-05-26T13:25:40-04:00 — #2
There aren't any other files in the directory. Hmm, gimme a sec, I'll run a test with some txt file or other.
starlion — 2011-05-26T12:36:40-04:00 — #3
this request isnt being called from /Users/mickyginger/Sites/galleries/Cradles/index.php is it? (Cant delete a file in use - which it will be if it's open in anything...)
mickyginger — 2011-05-26T12:51:30-04:00 — #4
Nah, from /Users/mickyginger/Sites/admin/galleries/index.php ...
starlion — 2011-05-26T12:53:21-04:00 — #5
can you delete other files in that directory?
mickyginger — 2011-05-26T13:28:04-04:00 — #6
Nah, can't delete anything. I placed a text file in the folder with permissions set to 0777, and I got the same error.
aamonkey — 2011-05-26T15:08:17-04:00 — #7
there may be a directory above the one in question with lower permissions.
mickyginger — 2011-05-27T17:35:52-04:00 — #8
Yeah, but I kinda want that in place. Like, I don't want php to be able to delete important files. I thought that by setting up a subfolder with permissions set to 0777, I could put everything that I wanted php to delete in there, anything that's essential for the site would sit above it protected by lower permissions.
Am I on the wrong lines here?