Symfony,clear:cache"无法删除目录"在Vagrant

时间:2017-07-09 09:13:12

标签: symfony caching vagrant

当我清除Vagrant VM中的缓存时,我遇到了问题。这是配置文件的一部分:

synced_folder:
    vflsf_19mkvk0x71hk:
        source: /var/www/vm/vmnginx
        target: /var/www
        sync_type: default
        smb:
            smb_host: ''
            smb_username: ''
            smb_password: ''
            mount_options:
                dir_mode: '0775'
                file_mode: '0664'
        rsync:
            args:
                - '--verbose'
                - '--archive'
                - '-z'
            exclude:
                - .vagrant/
                - .git/
                - vendor/
            auto: 'true'
        owner: vagrant
        group: www-data

错误消息告诉我无法删除文件夹:

$ sfconsole cache:clear -vv
22:46:17 INFO      [php] User Deprecated: The "Symfony\Component\Console\Event\ConsoleExceptionEvent" class is deprecated since version 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead. ["exception" => Symfony\Component\Debug\Exception\ContextErrorException {trace: { …} …}] []


  [Symfony\Component\Filesystem\Exception\IOException]                                       
  Failed to remove directory "/var/www/formation/symfony-blog/var/cache/de~/translations": . 


Exception trace:
 () at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:176
 Symfony\Component\Filesystem\Filesystem->remove() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:172
 Symfony\Component\Filesystem\Filesystem->remove() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:70
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:264
 Symfony\Component\Console\Command\Command->run() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:887
 Symfony\Component\Console\Application->doRunCommand() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:223
 Symfony\Component\Console\Application->doRun() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:81
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/formation/symfony-blog/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:130
 Symfony\Component\Console\Application->run() at /var/www/formation/symfony-blog/bin/console:28

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

我已添加&#34; vagrant&#34;用户在&#34; www-data&#34;基。

文件夹:

$ ll var/cache/
total 16K
drwxrwxr-x 1 vagrant www-data 4,0K juil.  8 22:43 ./
drwxrwxr-x 1 vagrant www-data 4,0K juil.  7 16:01 ../
drwxrwxr-x 1 vagrant www-data 4,0K juil.  8 22:43 de~/
drwxrwxr-x 1 vagrant www-data 4,0K juil.  8 22:43 dev/

这里&#34;真实&#34; VM外的文件夹:

✔ /var/www/vm/vmnginx/formation/symfony-blog [master {origin/master}|✚ 9] 
11:10 $ ll var/cache/
total 16K
drwxrwxr-x 4 fabrice fabrice 4,0K juil.  9 09:56 ./
drwxrwxr-x 5 fabrice fabrice 4,0K juil.  7 16:01 ../
drwxrwxr-x 3 fabrice fabrice 4,0K juil.  9 09:56 de~/
drwxrwxr-x 7 fabrice fabrice 4,0K juil.  9 09:56 dev/

而且,我无法更改权限,即使使用sudo也是如此。没有错误信息,但没有任何事情发生。

&#34; rm -fr var / cache&#34;的工作原理。

请你帮我。

和Fabrice

2 个答案:

答案 0 :(得分:0)

在必须的情况下,这是最后一次治疗,但它的工作。看看那里:

https://symfony.com/doc/current/setup/file_permissions.html#using-acl-on-a-system-that-supports-setfacl-linux-bsd

答案 1 :(得分:0)

$ ll var/cache/de~
total 1,3M
drwxrwxr-x 1 vagrant www-data 4,0K juil.  9 09:56 ./
drwxrwxr-x 1 vagrant www-data 4,0K juil.  9 09:56 ../
-rwxrwxr-- 1 vagrant www-data 130K juil.  8 22:43 appDevDebugProjectContainerCompiler.log*
-rwxrwxr-- 1 vagrant www-data 459K juil.  9 09:56 appDevDebugProjectContainer.php*
-rwxrwxr-- 1 vagrant www-data  26K juil.  9 09:56 appDevDebugProjectContainer.php.meta*
-rwxrwxr-- 1 vagrant www-data 365K juil.  8 22:43 appDevDebugProjectContainer.xml*
-rwxrwxr-- 1 vagrant www-data 314K juil.  8 22:43 classes.php*
drwxrwxr-x 1 vagrant www-data 4,0K juil.  9 09:56 pools/

$ ll var/cache/de~/pools/
total 8,0K
drwxrwxr-x 1 vagrant www-data 4,0K juil.  9 09:56 ./
drwxrwxr-x 1 vagrant www-data 4,0K juil.  9 09:56 ../