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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    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/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
    on line 254


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

    #2
    Re: permission error on unlink, but who has permission if not PHP?

    "lawrence" a écrit le 17/11/2003 :[color=blue]
    > 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/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
    > on line 254
    >
    >
    > I don't get it. If PHP uploads the file, how can PHP not have the
    > permission to delete it?[/color]

    Change the rights with chmod(777) before deleting.


    Comment

    • Matty

      #3
      Re: permission error on unlink, but who has permission if not PHP?

      Jedi121 wrote:

      [color=blue][color=green]
      >> I don't get it. If PHP uploads the file, how can PHP not have the
      >> permission to delete it?[/color]
      >
      > Change the rights with chmod(777) before deleting.[/color]

      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,

      Comment

      • Kevin Collins

        #4
        Re: permission error on unlink, but who has permission if not PHP?

        lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0311171149.7aa0 10cb@posting.go ogle.com>...[color=blue]
        > 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/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
        > on line 254
        >
        >
        > I don't get it. If PHP uploads the file, how can PHP not have the
        > permission to delete it?[/color]

        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

        Comment

        • lawrence

          #5
          Re: permission error on unlink, but who has permission if not PHP?

          lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0311171149.7aa0 10cb@posting.go ogle.com>...[color=blue]
          > 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/publicdomainsof tware.org/htdocs/ppUtilityCode/mcAdminImages.p hp
          > on line 254
          >
          >
          > I don't get it. If PHP uploads the file, how can PHP not have the
          > permission to delete it?[/color]

          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.

          Comment

          Working...