Symfony缺少bootstrap.php.cache

Del*_*ium 6 php amazon-web-services symfony

我正在使用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 
Run Code Online (Sandbox Code Playgroud)

我知道,这是因为我错过了应该由作曲家生成的bootstrap.php.cache,但什么都没有.

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

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

Ari*_*ris 14

执行以下命令:

sudo php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
Run Code Online (Sandbox Code Playgroud)

  • 更新:在我当前版本的sensio/distribution-bundle(5.0)中,脚本已被移动,请尝试`sudo php vendor/sensio/distribution-bundle/Resources/bin/build_bootstrap.php` (4认同)

i.a*_*iel 6

迟到的评论但是:

boostrap.php.cache文件由 composer.json 脚本部分的钩子生成。进一步来说 :

"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
Run Code Online (Sandbox Code Playgroud)

当使用--no-scripts这些钩子运行 composer install 时,不会执行

但是,生成此文件是为了提高性能。As 与更高版本的 PHP 无关。你可以简单地删除它。

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