Problems with cap deploy a symfony2 project, can't find app/bootstrap.php.cache

老子叫甜甜 提交于 2019-12-23 18:50:29

问题


I'm trying (for the first time) to use capifony to deploy my site from my github repo. It runs right through to the setup phase and has this error:

** [out :: example.me] PHP Warning:  require_once(/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/example/prod/releases/20111208212344/app/console on line 4
 ** [out :: example.me] PHP Fatal error:  require_once(): Failed opening required '/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/example/prod/releases/20111208212344/app/console on line 4
 ** [out :: example.me] PHP Warning:  require_once(/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/example/prod/releases/20111208212344/app/console on line 4
 ** [out :: example.me] PHP Fatal error:  require_once(): Failed opening required '/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/example/prod/releases/20111208212344/app/console on line 4
    command finished in 106300ms
  * executing `symfony:assets:install'
  * executing "cd /var/www/example/prod/releases/20111208212344 && php app/console assets:install web --env=prod"
    servers: ["example.me"]
    [example.me] executing command
 ** [out :: example.me] PHP Warning:  require_once(/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/example/prod/releases/20111208212344/app/console on line 4
 ** [out :: example.me] PHP Fatal error:  require_once(): Failed opening required '/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/example/prod/releases/20111208212344/app/console on line 4
    command finished in 1294ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/example/prod/releases/20111208212344; true"
    servers: ["example.me"]
    [example.me] executing command
    command finished in 1329ms
failed: "sh -c 'cd /var/www/example/prod/releases/20111208212344 && php app/console assets:install web --env=prod'" on example.me

Has anyone encoutered this? Any ideas what could be the cause?


回答1:


It has to do with symlinks to the vendors directory. here is the solution with more detail: https://github.com/symfony/symfony-standard/pull/215




回答2:


I was stuck on this for a while, I'm not sure if it's exactly the same issue. When I deployed vi Capifony, the bootstrap.php.cache file was pointing to my FormBundle.php file, but in a previous release folder tha no longer existed. I took a look at the code in vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php and the path it uses is realpath(DIR.'/../../../../../../../../app') - hardcoded path, wtf? The problem with this is that my vendor folder is outside of mySymfony setup in a shared folder, so that realpath points to nothing useful.

It does however checking for an server variable ($_SERVER('argv')) a bit further up in the code, so I just set that in the vhosts adding this to the file: SetEnv argv /var/www/njc-forms/current

Hope that helps someone out there.



来源:https://stackoverflow.com/questions/8437991/problems-with-cap-deploy-a-symfony2-project-cant-find-app-bootstrap-php-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!