Symfony Warning: rename (../app/cache/dev,../app/cache/dev_old): Access denied. (Code: 5)

I am working on a symfony project.

When I try to do:

php app/console cache:clear 

I get the following ErrorException:

 Warning : rename (../app/cache/dev , ../app/cache/dev_old ) : Access Denied . (Code : 5) in ../vendors/Symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php on line 76 

What is the problem? I gave all permissions to the user on my computer (Windows 7). Any ideas why this is happening?

Thanks.

+7
source share
6 answers

Make sure the files are not used (as indicated by meze ). If you use something like TortoiseGit or Netbeans, etc. - Be sure to mark the cache folder as ignored so that it is not accessed.

If all else fails, download a free program, such as Unlocker , which allows you to quickly and easily separate the running processes from the files / folders that you are trying to change.

+11
source

To expand the cleanup report, Symfony 2 cache cleanup operations move cached items to different folders during cleanup. Part of this process includes creating a cache / dev-new / and cache / dev-old / folders.

If you use Eclipse or another IDE that dynamically monitors subfolders in your project, the IDE will almost instantly detect the creation of a new folder and look at the new files in these folders (in Eclipse, I noticed that the DLTK module constantly does this to represent progress). Unfortunately, this may interfere with Symfony, which wants to rename and / or delete these folders.

In particular, with Eclipse Indigo on Windows 7 with a 64-bit version, you can remove the cache /, cache / dev /, cache / dev_old / and cache / dev_new / folders from the build path by right-clicking your project and choosing "Build Path > Customize the build path ... ". This did not initially affect me; I continued to see how the DLTK module is trying to index the cache folders. I ended up removing the Aptana Studio plug-in by closing all Editor documents, disabling Eclipse, manually deleting subfolders in the cache / folder, starting the Symfony cache: clean, then start Eclipse and reinstall Aptana. It seems to have worked so far.

+6
source

This is a problem with Symfony 2.0.x and Symfony 2.1.x. This is a workaround for this:

Open the file: src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php

and add a sleep(1); statement sleep(1); in case of failure when creating a directory in the execute() function:

  //... rename($realCacheDir, $oldCacheDir); sleep(1); rename($warmupDir, $realCacheDir); //... 

You may need to open the CLI twice and run cache:clear , but after that the problem will be fixed.

+5
source

To have peace of mind once and for all, I create a clear.bat file in the MyProject folder under Windows 7.

 rmdir d:\symfony\framework-standard-edition\app\cache\ /S /Q 

I guarantee 100% cache cleaning efficiency. Some minor problems may occur after the first site update: Symfony must recreate some of the folders they need.

0
source

If you use text editors as Sublime Text, try to ignore the path of cached files

Go to Settings / Settings

edit configuration file

 { ... "folder_exclude_patterns": ["var","node_modules", ".git"], ... } 

in my case

Container folder cache.

Symfony 4

/ var

Symfony 2

/ Application / cache

Good coding!

0
source

SYMPHONY AND ANTI-VIRUS

A few symfony calls on the local Windows machine interbreed with some antivirus programs, such as NOD in my case. Exclude symfony cache folder from real time

-one
source

All Articles