When I download a file with curl through php I cannot seem to be able to delete it afterwards through ftp. I can delete it through the php script, but that's not exactly perfect. If the file isn't downloaded via curl, but still via php I can delete the file, it's just ones downloaded via curl that I cannot delete. When I try to run chown() through php on the file it gives me a permissions error. I've tested the same php script on multiple other servers and it works fine there, it's just this particular one it doesn't work on. Maybe it has something to do with php configuration and permissions but I'm not 100% on that.
+2
A:
Sounds like it is saved with the file owner being the user account of the web server. A non-privileged account can't chown
to a different user, either, so that explains why chown
fails... Try having PHP execute chmod 777
on the file before you delete it.
Mark Snidovich
2010-09-05 20:35:09
A:
When you create a file it is usually owned by the Apache user (or whatever app server you use). The FTP user however is not the same one most of the time. You can fix this by adding the FTP user to the Apache group (or the other way around). Sometimes they already share a group (like on many plesk environments) so making files readable and writeable for that shared group may solve the issue.
Kau-Boy
2010-09-05 20:43:02