cache:clear and "Permission denied" on Windows7

Showing 1-8 of 8 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":

[ErrorException]
  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.

http://www.php.net/manual/en/function.rename.php#102274

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

            rename($realCacheDir, $oldCacheDir);
            sleep(1);
            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?

Cheers
Matthias
Re: cache:clear and "Permission denied" on Windows7 Jin Lu 6/28/12 9:43 AM
I had exactly problem with you, this bug took me days already, first I thought it was because wrong access permission of the cache directory, but it was rightly configured. I was driving crazy before your post, your solution works but I have to set the sleep time a little bit longer on my system.
 

在 2012年6月7日星期四UTC+2下午5时12分17秒,M. Althaus写道:
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.

have a look at http://www.vagrantup.com

Am Donnerstag, 7. Juni 2012 17:12:17 UTC+2 schrieb M. Althaus:
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 <kifah...@devbliss.com>

--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com
 
You received this message because you are subscribed to the Google
Groups "Symfony2" group.
To post to this group, send email to symf...@googlegroups.com
To unsubscribe from this group, send email to
symfony2+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony2?hl=en

Re: [Symfony2] Re: cache:clear and "Permission denied" on Windows7 fc1982 8/21/12 8:21 AM
I have the same problem on Win 7, have you found a solution?

El jueves, 5 de julio de 2012 04:44:50 UTC-3, M. Althaus escribió:
Re: cache:clear and "Permission denied" on Windows7 Collin Lavoie 10/22/12 1:55 PM
Hi,

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

  [ErrorException]
  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.

Collin


Le jeudi 7 juin 2012 11:12:17 UTC-4, M. Althaus a écrit :
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.

Cheers
Matthias



Am 23.10.2012 08:26 schrieb Collin Lavoie <col...@secureops.com>:

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?