Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:23:27+00:00 2026-05-28T02:23:27+00:00

When I cap deploy my Symfony2 project, then log into my server I see

  • 0

When I cap deploy 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.

The error is

[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...', '<?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->loadClassCache()\n#3 {main}\n  thrown in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache on line 1079

Looking at the recently deployed cache directory I see:

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

I can fix the issue with chown -R www-data.www-data prod/ but I wondered if I can stop this from happening in the first place? And why do the directories have different owners?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:23:28+00:00Added an answer on May 28, 2026 at 2:23 am

    This happens because your web-server is running by user, who is not able to write to just created cache/prod directory.

    There are two solutions, which I know and use. First, add extra commands to run after deployment to Capfile. Capfile will like this:

    load 'deploy' if respond_to?(:namespace) # cap2 differentiator
    Dir['vendor/bundles/*/*/recipes/*.rb'].each { |bundle| load(bundle) }
    load Gem.find_files('symfony2.rb').last.to_s
    
    after "deploy:finalize_update" do
      run "sudo chown -R www-data:www-data #{latest_release}/#{cache_path}"
      run "sudo chown -R www-data:www-data #{latest_release}/#{log_path}"
      run "sudo chmod -R 777 #{latest_release}/#{cache_path}"
    end
    
    load 'app/config/deploy'
    

    Second solution is more elegant. You specify correct user, who can write to cache in deploy.rb and make sure that you don’t use sudo:

    set :user, "anton"
    set :use_sudo, false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My service communicates with a server that manages accounts. Each Account has a cap
Everytime I run cap deploy in the remote server I lost some unversioned files
I'm trying to deploy a Rails app that uses Bundler via Capistrano. Running cap
Deploying an app first time with Capistrano, but having problem running the cap deploy:update
This is my first deployment. I did a cap deploy:setup which worked fine. Then,
I am now trying to deploy my application to my ubuntu server-11.04(hostname: chicago), but
I am currently deploying a Rails application using Capistrano. Cap deploy:update_code usually works just
Does Google cap the number of connections a server can make to Google IMAP
I tried using "cap rollback" but I get the following error: $ cap rollback
Each time i run on my local machine cap:deploy i get next error when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.