Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony missing bootstrap.php.cache

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

like image 719
Delirium Avatar asked Jan 29 '16 09:01

Delirium


Video Answer


3 Answers

Execute following command:

sudo php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
like image 164
Aris Avatar answered Oct 16 '22 17:10

Aris


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
like image 8
i.am.michiel Avatar answered Oct 16 '22 15:10

i.am.michiel


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
like image 2
Yuseferi Avatar answered Oct 16 '22 17:10

Yuseferi