Yii installation stepping pit



Using the composer installation, you can configure the cookievalidationkey without modifying the config / web.php file, and the composer will generate it by itself.

Composer installation yii2

For the installation of yii2, I recommend using composer. If the computer does not have composer, users can download composer first. There are still many online tutorials.

After installing composer, run the following command in the folder where you want to install the yii2 project to install the Yii application template:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

After running, a new file name folder named basic will appear under the folder you specified earlier. Of course, if you want to use another name, you can modify the basic in the command and replace it with your own name.

installation is complete

After installation, configure your web server or use the built-in web server. Under the project web directory, you can use the following command:

php yii serve

Note: by default, HTTPS server will listen to 8080. However, if this port is already used or you want to run multiple applications in this way, you can specify which ports to use. Add only the – port parameter:

php yii serve --port=8888

After installation, you can use the browser to access the newly installed Yii application through the following URL:


This work adoptsCC agreement, reprint must indicate the author and the link to this article