title: Capifony and directory owners
body: <p>When I <code>cap deploy</code> my Symfony2 project, then log into my server I see that the the dev (app_dev.php) runs ok but the prod version (app.php) does not. </p>
  
  <p>The error is </p>
  
  <pre><code>[Tue Jan 03 14:31:48 2012] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Failed to write cache file "/var/www/example/prod/releases/20120103202539/app/cache/prod/classes.php".' in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache:1079\nStack trace:\n#0 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(1017): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::writeCacheFile('/var/www/example/p...', '&lt;?php  ????name...')\n#1 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(682): Symfony\\Component\\ClassLoader\\ClassCollectionLoader::load(Array, '/var/www/example/p...', 'classes', false, false, '.php')\n#2 /var/www/example/prod/releases/20120103202539/web/app.php(10): Symfony\\Component\\HttpKernel\\Kernel-&gt;loadClassCache()\n#3 {main}\n  thrown in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache on line 1079
  </code></pre>
  
  <p>Looking at the recently deployed cache directory I see:</p>
  
  <pre><code>drwxrwxrwx 4 root     root     4096 Jan  3 14:28 .
  drwxrwxr-x 5 root     root     4096 Jan  3 14:28 ..
  drwxr-xr-x 6 www-data www-data 4096 Jan  3 14:28 dev
  drwxrwxr-x 7 root     root     4096 Jan  3 14:28 prod
  </code></pre>
  
  <p>I can fix the issue with <code>chown -R www-data.www-data prod/</code> but I wondered if I can stop this from happening in the first place? And why do the directories have different owners?</p>