Search code examples
phpsymfonysymfony4

Symfony 4.2 update question - Bootstrap.php file unused


I updated a Symfony 4.1 App to 4.2 few days/weeks ago and I noticed there is now a bootstrap.php file inside config/. It was added during 4.2 update.

This file seems to do the same thing as my public/index.php (checks the environnement, if there is variable in apache or using .env, requires the vendor autoload.)

The thing is this file is not used.

Should I require it in my public/index.php or just don't change anything (and not use it)?


Solution

  • In a default Symfony 4.2 installation, that file is used (required) from index.php

    So you could remove the redundant logic from your older public/index.php file, and require this one.

    The same file is required from bin/console, so the project is appropriately bootstrapped for console commands as well.

    If you are upgradeing a < 4.2 app, and want to use the same index.php file as comes with the newer version, you can grab it from here.