title: Error with Symfony's cache and permissions
body: <p>I got this continuous error with cache. Something with permissions but I can't figure what's going on. In my local environment when I go a <code>php bin/console cache:clear -e=dev</code> it return me this</p>
  
  <pre><code>  [Symfony\Component\Filesystem\Exception\IOException]                                                                                               
    Failed to remove file "/project/var/cache/de~/pools/ORsqbHaOKl/L/K/iZULk48B-k00dzIKC2qg": unlink(/project/var/cache/de~/pools/ORsqbHaOKl/L/K/iZULk48B-k00dzIKC2qg): Permission denied.    
  </code></pre>
  
  <p>So I need to make first a <code>chmod -R 777 var/</code>, then again the clear cache and it works. But when I run the website it return me </p>
  
  <pre><code>Failed to create "/project/var/cache/dev/tcpdf": mkdir(): Permission denied.
  </code></pre>
  
  <p>So I need again to make <code>chmod -R 777 var/</code></p>
  
  <p>In the production server without erasing anything sometimes i get this error</p>
  
  <pre><code>Warning: rename(C:\project\var\cache\prod/doctrine/orm/Proxies\__CG__AppBundleEntitySomeEntity.php.5a142ad84e8464.47105642,C:\project\var\cache\prod/doctrine/orm/Proxies\__CG__AppBundleEntitySomeEntity.php): Access is denied. (code: 5)
  </code></pre>
  
  <blockquote>
    <p>error in vendor\doctrine\common\lib\Doctrine\Common\Proxy\ProxyGenerator.php
    (line 309 rename())</p>
  </blockquote>
  
  <pre><code>    $tmpFileName = $fileName . '.' . uniqid('', true);
      file_put_contents($tmpFileName, $proxyCode);
      @chmod($tmpFileName, 0664);
      rename($tmpFileName, $fileName);
  }
  </code></pre>
  
  <p>Local environment: debian 9
  Production environment: windows server 2008</p>