Bug #22488 [Opn->Csd]: Permission denied for unlink() , copy(), rename(), move_uploaded_file() FAT32
| From: | felipe@php.net | Date: | Wed, 23 May 2012 23:56:25 +0000 |
| Subject: | Bug #22488 [Opn->Csd]: Permission denied for unlink() , copy(), rename(), move_uploaded_file() FAT32 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170741@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=22488&edit=1
ID: 22488
Updated by: felipe@php.net
Reported by: ajes2kemais at gmail dot com
Summary: Permission denied for unlink() , copy(), rename(),
move_uploaded_file() FAT32
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Windows NT 4.0 SP6
PHP Version: 4.2.3
-Assigned To:
+Assigned To: felipe
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2003-03-17 10:19:48] kemal at thelimelight dot nl
*** Still more info:
Microsoft acknowledge this problem (caching of objects requested via FTP/HTTP) affecting IIS 4.0.
See for example:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q184956
http://support.microsoft.com/default.aspx?scid=kb;en-us;191742
http://support.microsoft.com/default.aspx?scid=kb;EN-US;182626
Suggested workarounds:
a) Disable IIS caching (registry change)
b) Lowers caching time (registry change)
c) Wait ~30 seconds in a loop while overwriting file (script change)
d) Use copy() instead of move_uploaded_file() (script change). It appears that copy() has less
problem than other methods.
------------------------------------------------------------------------
[2003-03-02 05:18:33] wez@php.net
Not a bug in PHP; PHP cannot write to a file that is in use; it is your responsibility to work
around this problem with IIS in your script.
As a suggestion, you could try adding a 2 second sleep before attempting to move the file; this
should allow enough time for the OS to decide that the access is OK.
------------------------------------------------------------------------
[2003-03-02 03:49:28] kemal at thelimelight dot nl
**** New Discovery: the 'permission denied' problem outlined above only manifests itself
when the existing file to be overwriten has just been recently accessed by IIS (ie the image file
has been very recently requested by a HTML page).
Eliminating the line which contains the <IMG SRC="%s"> tag in the sample script
above results in perfect running of the script.
Conclusion: any attempt to overwrite the file was denied by the OS (NT4 in my case) because the file
was marked "in-use". It should not have been so, because the file is only accessed for a
short time, and it happened a few minutes before. I don't know whether this is an IIS bug or
PHP bug.
------------------------------------------------------------------------
[2003-03-01 20:06:07] kemal at thelimelight dot nl
**** Additional test done with PHP 4.3.2-dev (build date Mar 2 2003 02:16:38): same result as with
previous versions.
------------------------------------------------------------------------
[2003-03-01 11:36:26] wez@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
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=22488
--
Edit this bug report at https://bugs.php.net/bug.php?id=22488&edit=1