> Subject: RE: PHP unlink Permission Error> From: ash@xxxxxxxxxxxxxxxxxxxx> To: ajwei@xxxxxxxxxxxxx> CC: php-general@xxxxxxxxxxxxx> Date: Tue, 13 Jan 2009 17:07:34 +0000> > On Tue, 2009-01-13 at 11:49 -0500, Alice Wei wrote:> > > > > > > > > Subject: RE: PHP unlink Permission Error> > > From: ash@xxxxxxxxxxxxxxxxxxxx> > > To: ajwei@xxxxxxxxxxxxx> > > CC: php-general@xxxxxxxxxxxxx> > > 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@xxxxxxxxxxxxxxxxxx(email)> > > > http://www.procurecenters.com/index.php (web) > > > > > > > > > > > > > > > > > > > > > > > > > > > >> > ______________________________________________________________________> > > > Subject: RE: PHP unlink Permission Error> > > > From: ash@xxxxxxxxxxxxxxxxxxxx> > > > To: ajwei@xxxxxxxxxxxxx> > > > CC: php-general@xxxxxxxxxxxxx> > > > 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> Hi, It is weird, because what is on my code for appending and writing looks like this: $myFile = "testFile.txt"; $fh = fopen($myFile, 'a'); fwrite($fh, $hello); fwrite($fh, "\r\n"); fclose($fh); The file itself gets executed continuously based on the number I have on the loop. And, my file for creating the file, I have shortened it to only 2 lines: $handle = fopen("testFile.txt", "w"); fclose($handle); What is interesting is that the files seem to be working, but the file keeps on getting appended rather than recreated when the my code to "w" the file get executed. I am using this with Actionscript, which calls the first function to open and write the file (or clean up the file), and then do whatever is needed in the second function to append the text to the file. Am I doing anything wrong here? Thanks in advance. _________________________________________________________________ Use Messenger to talk to your IM friends, even those on Yahoo! http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe