title: Capistrano Symlinks Being Cached?
body: <p>I've been setting up PHP deployments with Capistrano on CentOS 6 and have run into an interesting issue. The way capistrano works, it sets up folders like this:</p>
  
  <ul>
  <li>/var/www/myapp.com/
  <ul>
  <li>current (symlink to latest release in /releases)</li>
  <li>shared</li>
  <li>releases
  <ul>
  <li>20130826172737</li>
  <li>20130826172114</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>When I look at the "current" symlink, it points to the most recent release. At first, when opening my web app, everything worked fine. After deploying a new release, the <strong>current</strong> folder correctly points to the new release, but the web application tries to load files from the old release (which has been deleted in a Capistrano cleanup process). Also, the virtual host is configured to point at <strong>/var/www/myapp.com/current/Public</strong>.</p>
  
  <p>Are symlinks cached in any way? </p>
  
  <p>The specific PHP code that fails (which initializes my framework) is this:</p>
  
  <pre><code>require_once dirname(dirname(__FILE__)) . '/App/App.php';
  App\App::run();
  </code></pre>
  
  <p>That is in <strong>index.php</strong> currently located at <strong>/var/www/app.com/current/Public/index.php</strong>. </p>
  
  <p>My Apache error logs show:</p>
  
  <blockquote>
    <p>PHP Fatal error:  require_once(): Failed opening required '/var/www/myapp.com/releases/20130826172237/App/App.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/myapp.com/releases/20130826172237/Public/index.php</p>
  </blockquote>
  
  <p>And the <strong>current</strong> symlink shows:</p>
  
  <blockquote>
    <p>current -> /var/www/zverse/releases/20130826172641</p>
  </blockquote>
  
  <p>Obviously 20130826172641 != 20130826172237 which the latter was the previous version.</p>
  
  <p>Any ideas or areas I can look at?</p>