I’m trying to use Capistrano to deploy my PHP application from a Git repository but keep running into errors. The process works fine during the code checkout phase, but fails during the finalization step.
When I execute cap deploy, everything goes smoothly until the deploy:finalize_update task runs. At this point, Capistrano tries to create symbolic links and set up the directory structure:
*** [err :: myapp.com] find: `/var/www/myapp.com/releases/20100612153020/public/images': No such file or directory
The same error occurs for the stylesheets and javascripts folders. I’m using a PHP-specific Capistrano extension. Any ideas what might be causing this issue?
Had this exact problem deploying a custom PHP CMS last year. Capistrano assumes you’re using Rails, so it tries updating asset timestamps on directories that don’t exist in most PHP projects. Don’t bother modifying core tasks or creating dummy folders - just add a conditional check to your deployment recipe. Before finalize_update runs, test if the directories exist first, then only run the timestamp commands if they’re actually there. Something like [ -d \"#{latest_release}/public/images\" ] before the find command works perfectly. Your deployment stays flexible and works with any PHP project structure without forcing you to reorganize your code or maintain empty folders just to keep the deployment tool happy.
Had this exact problem two years ago setting up automated deployments for a client’s PHP framework. Capistrano expects Rails directory structures that don’t exist in PHP projects. Instead of creating fake directories or disabling everything, I wrapped the asset timestamp task in an existence check. Just check if the directories are actually there before running the find operation. This way you keep normal Capistrano functionality for projects with standard asset folders, but PHP apps with different structures won’t break. Make your deployment script adapt to your project, don’t force your project to match Rails conventions.
Here’s what worked for me - customize the asset paths instead of disabling everything. In your deploy.rb, redefine the asset directories to match your PHP structure: set :asset_children, %w(public/css public/js public/img) or whatever folders you actually have. Capistrano will still handle timestamping correctly for real assets, but it’ll look in the right spots instead of Rails defaults. If your PHP app doesn’t use standard asset folders at all, just set an empty array set :asset_children, [] - this skips the find command entirely without overriding the whole finalize_update task. Way cleaner than monkey-patching core Capistrano behavior.
The problem is Capistrano’s Rails defaults trying to touch asset files in directories that don’t exist in your PHP project. Don’t override the entire finalize_update task - just disable asset timestamping by adding set :normalize_asset_timestamps, false to your deploy.rb file. You’ll keep the good stuff like proper permissions and symlinks while skipping the broken find command that’s killing your deployment. I’ve found this way cleaner than replacing the whole task since you still get the standard directory setup without Rails asset handling.
Had this exact problem migrating a legacy PHP app to Capistrano. Capistrano expects a Rails-style directory structure, so it’s looking for folders that don’t exist in PHP projects. Just create the directories it wants - add empty public/images, public/stylesheets, and public/javascripts folders to your project root and commit them. Capistrano will find what it needs during the find command without you having to mess with deployment scripts. Throw .gitkeep files in there if you want to use them as real asset folders later. Keeps your deployment config clean and fixes those annoying directory errors.
i think u might need to check ur config files. looks like it’s set up for rails instead of php. those asset folders aren’t part of php apps. u can either skip those steps or just create the folders manually before deployment.
This happens because Capistrano’s default setup expects Rails asset directories that don’t exist in PHP apps. I ran into the same thing when I switched from Rails to PHP deployments. You need to override the finalize_update task in your deploy.rb file to skip the asset timestamp stuff. Add this:
namespace :deploy do
task :finalize_update, :roles => :app do
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
end
end
This replaces the default behavior that’s looking for Rails directories. You could create empty directories in your repo instead, but overriding the task works better for PHP apps.
quick fix: just mkdir the missing dirs that capistrano is lookin for, then add those to your .gitignore. makes it easy for deployment without cluttering your repo with empty folders.