469,327 Members | 1,226 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

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

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
4 14296
"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
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
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
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.

Similar topics

1 post views Thread by JaazzMan | last post: by
7 posts views Thread by Stéphane Ninin | last post: by
6 posts views Thread by Benjamin | last post: by
4 posts views Thread by nitinpatel1117 | last post: by
4 posts views Thread by srini4vasan | last post: by
15 posts views Thread by Morteneistrom | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.