After executing the init command in yii2, an error is reported: yii\web\request::cookieValidationKey must be configured with a secret key.
1. After executing the init command in yii2, an error is reported: yii\web\request::cookieValidationKey must be configured with a secret key. as shown in Figure 1
2. I finally decided to improve a set of files in the environments directory, because this is a new copy of the application. When generating cookie validation key in , it is determined that it is a missing domain namehttps://tougao.apply.localThe corresponding file generate cookie validation key in papersubmission/config/main-local.php. as shown in Figure 2
PS C:\wwwroot\apply-server\src> ./init
Yii Application Initialization Tool v1.0
Which environment do you want the application to be initialized in?
[0] Development
[1] Production
Your choice [0-1, or "q" to quit] 0
Initialize the application under 'Development' environment? [yes|no] yes
Start initialization ...
exist api/config/main-local.php
...overwrite? [Yes|No|All|Quit] All
overwrite api/config/main-local.php
unchanged api/config/params-local.php
unchanged backend/config/codeception-local.php
overwrite backend/config/main-local.php
unchanged backend/config/params-local.php
unchanged backend/config/test-local.php
unchanged backend/web/index-test.php
unchanged backend/web/index.php
unchanged backend/web/robots.txt
overwrite common/config/codeception-local.php
overwrite common/config/main-local.php
overwrite common/config/params-local.php
unchanged common/config/test-local.php
unchanged console/config/main-local.php
unchanged console/config/params-local.php
unchanged console/config/test-local.php
unchanged frontend/config/codeception-local.php
overwrite frontend/config/main-local.php
unchanged frontend/config/params-local.php
unchanged frontend/config/test-local.php
unchanged frontend/web/index-test.php
unchanged frontend/web/index.php
unchanged frontend/web/robots.txt
overwrite management/config/main-local.php
unchanged management/config/params-local.php
unchanged papersubmission/config/main-local.php
unchanged papersubmission/config/params-local.php
unchanged yii
unchanged yii_test
unchanged yii_test.bat
generate cookie validation key in backend/config/main-local.php
generate cookie validation key in common/config/codeception-local.php
generate cookie validation key in frontend/config/main-local.php
generate cookie validation key in management/config/main-local.php
generate cookie validation key in api/config/main-local.php
chmod 0777 backend/runtime
chmod 0777 backend/web/assets
chmod 0777 console/runtime
chmod 0777 frontend/runtime
chmod 0777 frontend/web/assets
chmod 0777 api/runtime
chmod 0777 api/web/assets
chmod 0777 management/runtime
chmod 0777 management/web/assets
chmod 0755 yii
chmod 0755 yii_test
... initialization completed.
3. Copy /environments/dev/frontend to /environments/dev/paperSubmission , copy /environments/prod/frontend to /environments/prod/paperSubmission , and then edit /environments/index.php , and add the configuration items related to PaperSubmission . as shown in Figure 3
4. After executing the init command again in yii2, an error will not be reported.


