cache:clear and "Permission denied" on Windows7

Showing 1-5 of 5 messages
cache:clear and "Permission denied" on Windows7 M. Althaus 6/7/12 8:12 AM
Hey there,

I encountered a strange behavuour with cache:clear after starting a new project some days ago. I've started from scratch with the 2.0.15 no-vendor edition, installed the vendors, set basic config etc.

The issue now is: Whenever I try to do a cache:clear with an existing cache directory, it fails on me cause I cannot rename "env_new" to "env":

  Warning: rename(D:/foobar/app/cache/dev_new,D:/foobar/app/cache/dev): Permission denied (code: 5) in D:\foobar\vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php line 74

After digging around I found this comment from Feb 2011 in the PHP manual:

rename() is working on Linux/UNIX but not working on Windows on a directory containing a file formerly opened within the same script. The problem persists even after properly closing the file and flushing the buffer.

When I add the workaround to CacheClearCommand->execute() at line 75 like this

            rename($realCacheDir, $oldCacheDir);
            rename($warmupDir, $realCacheDir);

The problem vanished and the script executes fine. I know... it's Windows... and to make it even stranger: The command works flawlessly in my old project (on 2.0.11). o_O

I tried everything to setup the new project... cache:clear fails all the time without that workaround.

Did anybody encounter this weird issue?

Re: cache:clear and "Permission denied" on Windows7 Kifah 7/2/12 4:03 AM
I recommend you to prepare a virtual machine, ubuntu based for example, and doo your console commands on it.
it will solve more problems than you can imagine.
you can still have your windows 7 on top of that, with your favorite IDE.

Re: [Symfony2] Re: cache:clear and "Permission denied" on Windows7 M. Althaus 7/5/12 12:44 AM
Thanks, but my customer has a Windows machine.

2012/7/2 Kifah <>

If you want to report a vulnerability issue on symfony, please send it to security at
You received this message because you are subscribed to the Google
Groups "Symfony2" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

AW: [Symfony2] Re: cache:clear and "Permission denied" on Windows7 Matthias Althaus 10/23/12 12:56 AM
Yeah... it breaks if an _old folder exists, but I can reproduce my error locally with a clean cache directory.


Am 23.10.2012 08:26 schrieb Collin Lavoie <>:


I had a similar problem, but in my case the error was related to renaming to dev_old (no-warmup):

  Warning: rename(C:/wamp/www/my-project/app/cache/dev,C:/wamp/www/my-project/app/cache/dev_old): Access is denied. (code: 5)
  in C:\wamp\www\my-project\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php line 71

I found that the "dev_old" folder already existed and that the problem was resolved by simply deleting it.

Re: cache:clear and "Permission denied" on Windows7 Caponica 8/15/13 4:22 AM
I still experience this problem with Sf2.3 - is there any appetite in the Sf core team to implement this sleep(1) workaround?