Combined with the information on the Internet, give a complete installation process (personally tested)
Premise: Very important, your PHP version must be php5.4 or above
1. First you need to download the application template, divided into basic templates and advanced application templates, here I use the Advanced application template as an example:
Go here now. Advanced Application Templates https://github.com/yiisoft/yii2-app-advanced
2. After download, unzip and put it in www directory I put it in D:\wamp\www\yii2\advanced.
The cmd dos command enters this D:\wamp\www\yii2\advanced:
3. Running php -r "readfile(‘https://getcomposer.org/installer‘);" | php
4. This is just under the D:\wamp\www\yii2\advanced
directory download a composer.phar
file, with this file can execute php composer.phar
commands, prompt:
5. Prepare all plugins!! It's very important, it's all going to fail with this step (remember to configure the PHP environment variable AH)
Execute command:php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
6. Install our YII2 application:
Execute command: The php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced ../yii2test
yii2test app is generated in the previous level directory.
Please note that the sixth step is likely to have been parked there, this time, login github username and password does not register an account, exit cmd, re-execute the 6th step.
If prompted for the installation process, enter your GitHub username and password. Then enter them and continue. Now it's possible to enter tokens.
7. Final step: Initialize our app, initialize it in the Yii2test directory you createdcmd init命令 选0 y
OK, so our YII2 installation is complete, enter the test directory:
localhost/yii2/yii2test/frontend/web/index.php
The first time under Windows installation process YII2, the whole process encountered a lot of problems, after twists and turns, fortunately finally successfully solved.
First, download Yii2 template
Using composer to install the YII2, you first need to download the application template, which is divided into basic template and advanced application template two kinds. Advanced Template Download
Second, GitHub token
Problem:
When installing YII2 applications, such as the use of commands
PHP composer.phar create-project--prefer-dist--stability=dev yiisoft/yii2-app-advanced.. /yii2_app
You will be asked to enter tokens at this time.
Workaround:
1, first exit cmd;
2, use the link url:https://github.com/settings/tokens, click Generate New token, Generate a new token (eg: bc018abcdeabcdea2ddef0qq119ca3f1234512345);
3. Next, Enter the command in CMD:
PHP Composer.phar config-g github-oauth.github.com bc018abcdeabcdea2ddef0qq119ca3f1234512345
At this point, in the file Auth.json, you can see
{ "Http-basic": {}, "Github-oauth": { "github.com": "bc018abcdeabcdea2ddef0qq119ca3f1234512345< style= "color: #FF0000;" ></span> "}}
4, re-execute the command, complete the installation of the YII2 application
PHP composer.phar create-project--prefer-dist--stability=dev yiisoft/yii2-app-advanced.. /yii2_app
Source Source 2
Yii2 Windows installation process