How To Set Env Settings.

Hi

I new user in YII2.

I have some question with environment. I use advanced template

  1. If I want to set database access on my local machine I add it on /env/commons/config/{dev or prod}/main-local.php

But from documentation it need add in /commons/config/main-local.php

If I do it as documantation, when I change, on local machine, environment to production (yii copy local files from env/prod/comons/* to /commons/* ) it overwrite my connect to db.

But if I add my database access or any else in /env/dev/commons/config/main-local.php It force to reload (php init) every time.

How to do it correctly?

  1. True or false follows:

common/config/main.php - all settings on dev and prod env. in all computers.

common/config/main-local.php - not write here. it overwrite from env. dir.

environments/dev/common/config/main-local.php - local settings in dev env. individual on each computer. it use when init dev environment. when init dev this file rewrites common/config/main-local.php

Thanks

Hey! What problem with my post? Please, help me…

  1. It’s expected that it will be overwritten.

  2. Partially true.