Edit report at https://bugs.php.net/bug.php?id=23687&edit=1
ID: 23687
Comment by: a dot eibach at gmx dot net
Reported by: a dot eibach at gmx dot net
Summary: Permission denied error with unlink()
Status: Bogus
Type: Bug
Package: Filesystem function related
Operating System: Windows 2000
PHP Version: 4.3.2RC3
Block user comment: N
Private report: N
New Comment:
Hi Sabbir,
I'm very astonished that this would be of help again even EIGHT years later.
I didn't even remember I had ever opened this bug :)
Previous Comments:
------------------------------------------------------------------------
[2011-09-29 06:03:33] saabbir at ovi dot com
Hi all,
That was really helpful. I was having the same problem and i googled a lot for
the solution. but couldnt find any handy solution.
After reading this one i got the problem that most of the time we open the file
and then try delete the file without even closing (using fclose()) the file.
Thats why we get the error that permission was denied.
Thanks for saving my time and server space. lolz
Sabbir
------------------------------------------------------------------------
[2003-05-18 17:44:07] a dot eibach at gmx dot net
YES!
And I just figured it out!
As I said "I wanted to keep it simple".
The whole stuff happened in a
if ($newdirhandle = @opendir($newdirname))
{
...
}
construct, and *THAT* was causing the problem.
You **must** do a closedir() _BEFORE_ doing this renaming stuff because you're
blocking everything otherwise.
Frankly, I thought these two could interact independently of each other, but in
fact, they're working closely together.
Anyway, thanks for your reactions.
-ae-
------------------------------------------------------------------------
[2003-05-18 17:26:51] [email protected]
You're just doing somethign wrong, this works fine here.
------------------------------------------------------------------------
[2003-05-18 17:09:10] [email protected]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2003-05-18 17:07:42] a dot eibach at gmx dot net
to sniper:
actually, this was problems with rename(), not unlink() at first instant in my
script.
But since I claim to know that rename() does a copy(), then uses unlink()
afterwards, the 'perm. denied' error hadn't to do with rename(), but with
unlink().
Yes, rmdir() works now (THANKS!) but I still have problems with unlink()'ing
files sometimes.
I admit this script was a very bad example. :|
I tried to keep it simple, but that was too simple...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=23687
--
Edit this bug report at https://bugs.php.net/bug.php?id=23687&edit=1