title: Composer: Can't write to cache file
body: <p>I am new to Symfony and Composer.</p>
  
  <p>I recently installed Symfony 3 with <a href="http://symfony.com/download." rel="nofollow">the installer</a> (on Linux) just as explained.
  Afterwards I also <a href="http://symfony.com/doc/master/cookbook/composer.html" rel="nofollow">installed Composer</a>.</p>
  
  <p>When I try to run <a href="http://symfony.com/doc/current/book/installation.html#updating-symfony-applications" rel="nofollow">an update with Composer</a> it gives errors like:</p>
  
  <pre><code>post-update-cmd: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
  PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Failed to write cache  
  file "/home/dev/var/bootstrap.php.cache".' in 
  /home/dev/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php:236
  </code></pre>
  
  <p>and</p>
  
  <pre><code>[RuntimeException]                            
  Unable to write in the cache directory (/home/dev/var/cache/dev)  
  
  Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the  
  post-install-cmd event terminated with an exception
  
  [RuntimeException]
  An error occurred when executing the "'cache:clear --no-warmup'" command:
  [RuntimeException]            
  Unable to write in the cache directory (/home/dev/var/cache/dev) 
  
  Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the 
  post-install-cmd event terminated with an exception
  [RuntimeException]                                     
  An error occurred when generating the bootstrap file.  
  </code></pre>
  
  <p>I found some issues but they were old and seem to have a specific reason. I just cannot figure out what is going wrong.</p>
  
  <p>I set the owner/group of <code>/var</code> to <code>www-data</code> which is the Apache 2 user. I set the write permissions for the group. Even tried 777 on <code>/var/cache</code> and <code>bootstrap.php.cache</code>. 
  It won't help.</p>
  
  <p>When I delete the <code>cache-dir</code> it is created normally by Symfony. <code>/var/cache/dev</code> and <code>/prod</code> are also created and loaded with dirs and files.
  I can't find <code>bootstrap.php.cache</code> anymore now. </p>
  
  <p>How can I fix this?</p>