#23687 [Bgs]: Permission denied error with unlink()
| From: | a dot eibach at gmx dot net | Date: | Sun, 18 May 2003 22:44:08 +0000 |
| Subject: | #23687 [Bgs]: Permission denied error with unlink() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-39917@lists.php.net to get a copy of this message | ||
ID: 23687
User updated by: a dot eibach at gmx dot net
Reported By: a dot eibach at gmx dot net
Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows 2000
PHP Version: 4.3.2RC3
New Comment:
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-
Previous Comments:
------------------------------------------------------------------------
[2003-05-18 17:26:51] sniper@php.net
You're just doing somethign wrong, this works fine here.
------------------------------------------------------------------------
[2003-05-18 17:09:10] wez@php.net
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...
------------------------------------------------------------------------
[2003-05-18 17:05:58] wez@php.net
php.net/rmdir
------------------------------------------------------------------------
[2003-05-18 17:03:51] a dot eibach at gmx dot net
Well, Windows seems to be *VERY* sensitive about this.
This thing didn't let me loose, and I just used the Task Manager and
killed the 'Explorer' Task - another one was initiated by Windows.
Now it worked!
I will test this through further and append some delays using sleep().
It might be that actions just get executed _too fast_ and Windows can't
follow as quickly as Linux.
------------------------------------------------------------------------
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
http://bugs.php.net/23687
--
Edit this bug report at http://bugs.php.net/?id=23687&edit=1