A mistake / missing information in Getting Started: Yii 2 Advanced Project Template

The “Preparing application” section says:

Create a new database and adjust the components['db'] configuration in /path/to/yii-application/common/config/main-local.php accordingly.

While in the same time (earlier) a concept of environments is introduced. The above line says nothing about adding changed database configuration to corresponding configuration files in environments folder. This cause that any call to php init and any change to environment will cause /path/to/yii-application/common/config/main-local.php file to be overwritten and the whole application to stop working.

Shouldn’t the guide be updated?

The environments folder is just a “setup” folder, with boilerplate content.

For each installation of your web app you should configure the main-local, since each installation could contain a different database configuration.

The php init is just a setup feature, IF you need to run it on a project that’s already configured, it will ask you if you wish to override the already created configuration files. In your case, you just need to choose the option to not override the already existing files.