Home > PHP Framework > YII > How to install yii2 tutorial

How to install yii2 tutorial

王林
Release: 2019-11-06 17:52:18
Original
2174 people have browsed it

How to install yii2 tutorial

Environmental requirements:

php version: php5.4 or above

Installation method:

1. Open the directory structure

After downloading the framework, there is an advanced folder inside after decompression. Open it to get the directory as shown below

How to install yii2 tutorial

2. Configure the access path

Open C:\Windows\System32\drivers\etc\hosts and copy the following code to the hosts file (as follows) Figure)

How to install yii2 tutorial

Copy the advanced project file decompressed above to the environment root directory, configure the access directory (take phpstudy as an example), and open phpstudy\apache\conf\vhosts.conf (Restart the apache service after modification)

<VirtualHost *:80>     
      DocumentRoot "F:\pro\advanced\frontend\web"     
      ServerName www.demo.com     
      ServerAlias www.demo.com  
  </VirtualHost>  
  
  <VirtualHost *:80>     
      DocumentRoot "F:\pro\advanced\backend\web"     
      ServerName admin.demo.com     
      ServerAlias admin.demo.com  
  </VirtualHost>
Copy after login

Note: F:\pro local environment root directory depends on the actual situation of the respective environment.

3. Configure environment variables

Add php.exe to system environment variables

Steps:

1. Right-click My Computer-Properties-Advanced-Environment Variables

2. Find the Path item (you may need to scroll down to find it), double-click the Path item at the end Add the path where your PHP directory and class library are located, including the preceding ";" (for example: ;C:\php;C:\php\ext)

3. Click the "New" button and click on " Enter "PHPRC" in "Variable Name" and enter the directory where the php.ini file is located in "Variable Value" (for example: C:\php). This step is to let Windows find php.ini

4. Run CMD to enter the installation directory, execute init or run init.bat in the installation directory, select 0 development mode to install

Demo

Open the browser to access http: //www.demo.com can see the front-end interface, http://admin.demo.com is the back-end interface (a login interface appears)

How to install yii2 tutorial

Recommended tutorial :yii tutorial

The above is the detailed content of How to install yii2 tutorial. 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