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
2. Configure the access path
Open C:\Windows\System32\drivers\etc\hosts and copy the following code to the hosts file (as follows) Figure)
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>
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)
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!