Symfony缺少bootstrap.php.cache

时间:2016-01-29 09:53:54

标签: php symfony amazon-web-services

我在AWS上使用jenkins进行持续部署。一切都很好,但是当我在我的页面上看时,出现了这个错误:

Warning: require_once(/var/app/web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/app/web/app.php on line 6 Fatal error: require_once(): Failed opening required '/var/app/web/../app/bootstrap.php.cache' (include_path='.:/usr/local/lib/php') in /var/app/web/app.php on line 6 

我知道,因为我错过了应该由作曲家生成的bootstrap.php.cache,但没有任何内容。

在dockerfile中我使用RUN composer install --no-scripts --optimize-autoloader

在入口点我有composer run-script post-install-cmd --no-interaction

4 个答案:

答案 0 :(得分:12)

执行以下命令:

sudo php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

答案 1 :(得分:2)

搜索"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 您的composer.json(如果存在),您可能只需要运行“ composer install”,

或最简单的解决方案是尝试在sf> = 3上运行

php vendor/sensio/distribution-bundle/Resources/bin/build_bootstrap.php

答案 2 :(得分:1)

最新评论,但:

boostrap.php.cache文件是由钩子composer.json脚本部分生成的。更具体地说:

"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",

使用--no-scripts运行composer安装时,不执行这些钩子

但是,此文件是为提高性能而生成的。与更新的PHP版本无关。您可以将其删除。

  1. 删除文件
  2. 编辑index.php或app.php以删除require bootstrap.php.cache
  3. 从composer.json文件中删除钩子

答案 3 :(得分:0)

在web文件夹中,您必须添加bootstrap.php.cache。它已经存在于symfony的app文件夹中。