title: Failed to write cache file "/var/www/myapp/app/cache/dev/classes.php" when clearing the cache
body: <p>I have installed Symfony 2.0.7 on Ubuntu 11.10. I have this problem:</p>
  
  <p>I changed the permissions of the <code>cache</code> e <code>logs</code> directories using the following commands: </p>
  
  <pre><code>chmod 777 -R cache
  chmod 777 -R logs
  </code></pre>
  
  <p>and all functions as I was expecting.</p>
  
  <p>Then I made:</p>
  
  <pre><code>app/console cache:clear
  </code></pre>
  
  <blockquote>
    <p>Clearing the cache for the dev environment with debug true</p>
    
    <p>permissions of cache/dev change to 755 and symfony cannot write in that:</p>
    
    <p>RuntimeException: Failed to write cache file "/var/www/myapp/app/cache/dev/classes.php".</p>
    
    <p>in /var/www/myapp/app/bootstrap.php.cache line 1079
    at ClassCollectionLoader::writeCacheFile() in /var/www/myapp/app/bootstrap.php.cache line 1017
    at ClassCollectionLoader::load() in /var/www/myapp/app/bootstrap.php.cache line 682
    at Kernel->loadClassCache() in /var/www/myapp/web/app_dev.php line 23</p>
  </blockquote>
  
  <p>How can I solve this apparent bug in Symfony 2?</p>