Home > PHP Framework > YII > How to install the yii framework in win environment?

How to install the yii framework in win environment?

青灯夜游
Release: 2020-07-24 10:46:46
Original
3126 people have browsed it

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__ . &#39;/params.php&#39;;
$db = require __DIR__ . &#39;/db.php&#39;;

$config = [
    &#39;id&#39; => &#39;basic&#39;,
    &#39;basePath&#39; => dirname(__DIR__),
    &#39;bootstrap&#39; => [&#39;log&#39;],
    &#39;aliases&#39; => [
        &#39;@bower&#39; => &#39;@vendor/bower-asset&#39;,
        &#39;@npm&#39;   => &#39;@vendor/npm-asset&#39;,
    ],
    &#39;components&#39; => [
        &#39;request&#39; => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            &#39;cookieValidationKey&#39; => &#39;abcdefg&#39;,  //给参数值即可
        ],
Copy after login

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"
Copy after login

How to install the yii framework in win environment?

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced www.dh.com
Copy after login

This The execution of this step takes a long time, and you may also be asked to enter your git username and password

How to install the yii framework in win environment?

How to install the yii framework in win environment?

. At this point, the installation is basically completed. The following steps It is initialization

First enter the project directory of your installation and find theinitscript

How to install the yii framework in win environment?

Execute the init script

init
Copy after login

Select development environment

0
Copy after login

Are you sure to choose

yes
Copy after login

How to install the yii framework in win environment?

成成

#Version upgrade

If you upgrade, there are official instructions. In fact, it is to enter the project directory in dos and execute a command

composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/inputmask
Copy after login

##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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template