By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

permission error on unlink, but who has permission if not PHP?

P: n/a
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsoftware.org/htdocs/ppUtilityCode/mcAdminImages.php
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"lawrence" a écrit le 17/11/2003 :
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsoftware.org/htdocs/ppUtilityCode/mcAdminImages.php
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


Change the rights with chmod(777) before deleting.
Jul 17 '05 #2

P: n/a
Jedi121 wrote:

I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


Change the rights with chmod(777) before deleting.


Also, output the name of the file you're trying to delete, so that
you can make sure it's really what you think it is...

It may be that you're trying to delete a directory that the webserver
process doesn't own, etc,
Jul 17 '05 #3

P: n/a
lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsoftware.org/htdocs/ppUtilityCode/mcAdminImages.php
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


If the file name you uploaded already existed on the web server and
the web server user (apache?) has write permissions to the file, it
will be allowed.

To unlink, the web server user must have write permissions to the
directory.

Conversely, if a user has write permissions to a directory, it may
delete files from that directory regardless of who owns them...

Hope this helps,

Kevin
Jul 17 '05 #4

P: n/a
lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
I wrote some code that let me upload a file to my server. Then I wrote
some code to let me delete the file. But when I try to delete, I get
this error:

Warning: Unlink failed (Permission denied) in
/usr/local/www/vhosts/publicdomainsoftware.org/htdocs/ppUtilityCode/mcAdminImages.php
on line 254
I don't get it. If PHP uploads the file, how can PHP not have the
permission to delete it?


Well, okay, what I get from this debate is that the first place I
should look for trouble is to make sure the code is trying to delete
the same file I think I specified. I appreciate feedback that tells
where to look for me trouble, so thanks.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.