RE: [PHP] PHP unlink Permission Error
| From: | Ashley Sheridan | Date: | Tue, 13 Jan 2009 17:07:34 +0000 |
| Subject: | RE: [PHP] PHP unlink Permission Error | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286237@lists.php.net to get a copy of this message | ||
On Tue, 2009-01-13 at 11:49 -0500, Alice Wei wrote:
>
>
>
> > Subject: RE: [PHP] PHP unlink Permission Error
> > From: ash@ashleysheridan.co.uk
> > To: ajwei@alumni.iu.edu
> > CC: php-general@lists.php.net
> > Date: Tue, 13 Jan 2009 16:50:31 +0000
> >
> > On Tue, 2009-01-13 at 11:33 -0500, Alice Wei wrote:
> > > Hi, Ashley:
> > >
> > > Sorry. To answer the question from your previous entry, it looks
> > > like that my permission could be set and changed for the folder,
> but
> > > when I do it on the "file", I only get 0666. I have the latest
> code on
> > > another entry.
> > >
> > > Thanks a lot for your help.
> > >
> > > Alice
> > >
> > >
> > >
> > >
> > > Alice Wei
> > >
> > > Indiana University, Master of Information Science
> > >
> > > Application Programmer
> > > ProCure Treatment Centers, Inc.
> > > 420 N. Walnut St.
> > > Bloomington, IN 47404
> > >
> > > 812-330-6644 (office)
> > > 812-219-5708 (mobile)
> > >
> > > Alice.Wei@procurecenters.com(email)
> > > http://www.procurecenters.com/index.php (web)
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> ______________________________________________________________________
> > > Subject: RE: [PHP] PHP unlink Permission Error
> > > From: ash@ashleysheridan.co.uk
> > > To: ajwei@alumni.iu.edu
> > > CC: php-general@lists.php.net
> > > Date: Tue, 13 Jan 2009 16:36:36 +0000
> > >
> > > <snip/>
> > >
> > > No, we tend to bottom-post on this list. It's just how we roll...
> > >
> > >
> > > Ash
> > > www.ashleysheridan.co.uk
> > >
> > >
> > >
> ______________________________________________________________________
> > > Check the weather nationwide with MSN Search Try it now!
> >
> > The user that your web server is running under (I'm guessing apache
> of
> > wwwrun) , does this have permission to write to the file. If not, it
> > won't be able to set the permissions for it. You may need to exec
> out a
> > sudo command to do it, but I wouldn't recommend this.
> >
> > If you need PHP to be able to delete the file, what put it there in
> the
> > first place?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
>
> What I am trying to do here is that a user would be pushing a button
> so that the data entries would generate an outfile. The only issue is
> that the lines would be appended in the file, (I have no issues with
> this part writing to the file, no permission errors, etc). Therefore,
> before the outfile is generated, I need to have the prexisting outfile
> removed and recreated to be written to so that it always stays a new
> file for use.
>
> This is why this script as you have seen is as it is so that I can
> constantly check if the file exists, and generate a new file if there
> is.
> In this case, is there something I could do?
>
>
> Thanks in advance.
>
> Alice
>
>
>
>
> ______________________________________________________________________
> All-in-one security and maintenance for your PC. Get a free 90-day
> trial! Learn more!
If your script is writing to the file, and the directory has 777
permissions, then there should be no trouble deleting the file. If
that's still a problem, why not each time the file needs to be created
anew, open the file with a w flag, which will open it for writing, and
will try to create the file if it doesn't already exist, so you wouldn't
ever need to delete it at all.
Ash
www.ashleysheridan.co.uk