Home > Article > PHP Framework > How to install the yii framework in win environment?
First method: Installation in the form of archive file (suitable for machines without composer installed)
Enter the download page https://www.yiiframework.com/download, choose to download the first
After the download is completed, there will be a compressed package, unzip it folder, just put it in the specified project directory file
Then try to access the directory and find an error.
Solution: Find web.php in the config directory File, probably line 17, just set the parameter value for cookieValidationKey (cookie encryption key); there is no need to modify it manually when using composer.
<?php $params = require __DIR__ . '/params.php'; $db = require __DIR__ . '/db.php'; $config = [ 'id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'abcdefg', //给参数值即可 ],
Second: Install with composer (needs to circumvent the wall)
First of all, you need to install composer under windows, not much here said. Of course, you also need to configure PHP environment variables, which I won’t go into here.
Address: https://getcomposer.org/Composer-Setup.exe
After Composer is installed, switch to a directory accessible through the Web and execute the following command You can install Yii:
Enter the dos command window through the windows'cmd' command and execute the following command
composer global require "fxp/composer-asset-plugin:~1.0.0"
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced www.dh.com
This The execution of this step takes a long time, and you may also be asked to enter your git username and password
. At this point, the installation is basically completed. The following steps It is initialization
First enter the project directory of your installation and find theinit
script
Execute the init script
init
Select development environment
0
Are you sure to choose
yes
成成
#Version upgrade
If you upgrade, there are official instructions. In fact, it is to enter the project directory in dos and execute a commandcomposer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/inputmask
##Related article tutorials Recommended: "
yii Framework Tutorial", "PHP Tutorial"
The above is the detailed content of How to install the yii framework in win environment?. For more information, please follow other related articles on the PHP Chinese website!