php rmdir() permission denied problem in WindowsSaturday 21 Feb 2009 11:26 Tags: PHP For anyone getting that annoying 'permission denied' error when using PHP's rmdir() function in Windows I finally found a solution. I'd always passed this problem off as something to do with NTFS and Windows sharing permissions and pretty much ignored it as it works online in Linux. A common use for rmdir() is in a loop, reading files and directories and deleting them. If you attempt to delete the directory you are reading within, without closing it first you will get this error, so always call closedir($handle) first, which embarrassingly enough was something I wasn't doing (tut tut).
I know there are other instances where the 'permission denied' error occurs but in this particular case I was able to solve my problem with the above code. Note I read on one forum the solution is to place an @ in front of rmdir(), ie. @rmdir(). This is error surpression and doesn't solve anything except make PHP NOT print the error! It seems LINUX does things differently, removing the 'in-use' directory after the current PHP script process has finished, hence why the error does not occur in LINUX. Comments (0) | Show channel: 09 Oct 2008 Tokyo Game Show 2008 05 Oct 2008 Tokyo Tower, Tokyo Curry Lab - Japan 04 Oct 2008 Japanese Sword Museum, Shinjuki, Japan 02 Oct 2008 Shinjuku, Tokyo - Japan 01 Oct 2008 Ueno, Tokyo - Japan, markets, park and zoo 29 Sep 2008 Ginza, Sony Building and Godzilla, Tokyo 28 Sep 2008 Harajuku, Shibuya, Takeshita Str, Tokyo 27 Sep 2008 Akihabara, Tokyo 26 Sep 2008 Travelling to Tokyo 10 Aug 2008 Google, sitemaps and images 02 Aug 2008 Money Saving Tips, Beat the credit crunch 28 Jul 2008 Convert MOV video to AVI format |