17

I am using continuous deployment with jenkins on AWS. Everything is OK, but when I look on my page, there is this error:

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 

I know, it's because I miss bootstrap.php.cache which should be generated by composer, but there is nothing.

In dockerfile I use RUN composer install --no-scripts --optimize-autoloader

and in entrypoint I have composer run-script post-install-cmd --no-interaction

4 Answers 4

24

Execute following command:

sudo php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php 
Sign up to request clarification or add additional context in comments.

4 Comments

Update: in my current version of sensio/distribution-bundle (5.0) the script has been moved, try sudo php vendor/sensio/distribution-bundle/Resources/bin/build_bootstrap.php
This will do run all other scripts as well sudo composer symfony-scripts
running cache:clear for all the environments solved my problem
The script has been moved, and the arguments to generate in var are php vendor/sensio/distribution-bundle/Resources/bin/build_bootstrap.php 0 0 1 otherwise it generates it in app/
8

A late comment but :

The boostrap.php.cache file is generated by a hooks the composer.json scripts section. More specifically :

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

When running the composer install with the --no-scripts those hooks are not executed.

However, this file is being generated for performance. As is not as relevant to later versions of PHP. You could simply remove it.

  1. Remove the file
  2. Edit the index.php or app.php to remove the require bootstrap.php.cache
  3. Removing the hook from the composer.json file

Comments

2

Search for "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", your composer.json if it exists there probably you just need to run 'composer install',

or easiest solution is try to run on sf >= 3

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

Comments

0

in web folder you have to add the bootstrap.php.cache . It is already being in the app folder of your symfony.

2 Comments

it is already exist in app folder. you can just copy and paste it from app to web folder.
I though composer will generate it? Because I have in my composer.json this: "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.