Yii2 advance Installation, yii2advance

Source: Internet
Author: User
Tags autoload install openssl openssl library yii

Yii2 advance Installation, yii2advance

Reprinted from: http://www.genshuixue.com/i-cxy/p/7986531

1. Prerequisites: the php version must be later than 5.4.

D: \ phpStudy> php-v PHP 5.5.17 (cli) (built: Sep 16 2014 16:17:50) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies D: \ phpStudy>

2. One installation method is to directly download the compressed package. We recommend that you use the composer Method for installation. Install openssl directly to ensure that php supports Openssl (php. ini) Search
2.1 Download and install composer. My environment is windows.

Http://getcomposer.org/doc/00-intro.md#installation-nix

Attachment: linux Installation Method

[Root @ mty01] # curl-sS https://getcomposer.org/installer | php Downloading 1.1.2... composer successfully installed to:/home/haozi/2016-06-03/composer. phar Use it: php composer. phar Some settings on your machine may cause stability issues with Composer. if you encounter issues, try to change the following: Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended. composer works with 5.3.2 + for most people, but there might be edge case issues. the OpenSSL library (1.0.0-fips) used by PHP does not support TLSv1.2 or TLSv1.1. If possible you shoshould upgrade OpenSSL to version 1.0.1 or above. [root @ mty01 2016-06-03] # ls composer. phar [root @ mty01 2016-06-03] # du-sh composer. phP 1.6 M composer. phar

3. After the composer installation is completed, you need to install the composer plug-in.

D: \ phpStudy \ WWW \ yii2> php composer. phar global require "fxp/composer-asset-plugin :~ 1.1.1 "Changed current directory to C:/Users/liuhao14/AppData/Roaming/Composer. /composer. json has been created Loading composer repositories with package information Updating dependencies (including require-dev)-Installing fxp/composer-asset-plugin (v1.1.4) Downloading: 100% Writing lock file Generating autoload files D: \ phpStudy \ WWW \ yii2>

4. You need to configure a github token before starting the installation. This means you need to apply for a github account and generate a token.
Refer to the following path for setting (note that the following xxxx is clearly a human bypass, so you cannot use it directly)

C: \ Users \ liuhao14 \ AppData \ Roaming \ Composer> dir/B. htaccess auth. json composer. json composer. lock composer. phar vendor C: \ Users \ liuhao14 \ AppData \ Roaming \ Composer> type auth. json {"github-oauth": {"github.com": "xxxxxxxxxxx6fc824ea5a76ebc5fcdxxxxxxxxxx"} C: \ Users \ liuhao14 \ AppData \ Roaming \ Composer>

5. Start installation. Due to problems in the domestic environment, the installation time is relatively long, and it is also common for half an hour. As long as the program is not dead, do not cut it off .....

D: \ phpStudy \ WWW \ yii2> php composer. phar create-project yiisoft/yii2-app-advanced advanced 2.0.8 Installing yiisoft/yii2-app-advanced (2.0.8)-Installing yiisoft/yii2-app-advanced (2.0.8) loading from cache Created project in advanced Loading composer submit with package information Updating dependencies (including require-dev)-Installing yiisoft/yii2-composer (2.0.4) Downloading: 100%-Installing swiftmailer/swiftmailer (v5.4.2) downloading: 100%-Installing bower-asset/jquery (2.2.4) Downloading: 100%-Installing bower-asset/yii2-pjax (v2.0.6) Downloading: 100%-Installing bower-asset/punycode (v1.3.2) downloading: 100%-Installing bower-asset/jquery. inputmask (3.2.7) Downloading: 100%-Installing cebe/markdown (1.1.0) Downloading: 100%-Installing ezyang/htmlpurifier (v4.7.0) Downloading: 100%-Installing loading/yii2 (2.0.8) Downloading: 100%-Installing yiisoft/yii2-swiftmailer (2.0.5) Downloading: 100%-Installing yiisoft/yii2-codeception (2.0.5) Downloading: 100%-Installing bower-asset/bootstrap (v3.3.5) Downloading: 100%-Installing yiisoft/yii2-bootstrap (2.0.6) Downloading: 100%-Installing yiisoft/yii2-debug (2.0.6) Downloading: 100%-Installing bower-asset/typeahead. js (v0.11.1) Downloading: 100%-Installing phpspec/php-diff (v1.1.0) Downloading: 100%-Installing yiisoft/yii2-gii (2.0.5) Downloading: 100%-Installing fzaninotto/faker (v1.6.0) downloading: 100%-Installing yiisoft/yii2-faker (2.0.3) Downloading: 100% Writing lock file Generating autoload files D: \ phpStudy \ WWW \ yii2>

5.1 perform configuration and initialization after installation

D: \ phpStudy \ WWW \ yii2 \ advanced> init Yii Application Initialization Tool v1.0 Which environment do you want the application to be initialized in? [0] Development [1] Production Your choice [0-1, or "q" to quit] 0 Initialize the application under 'development' environment? [Yes | no] yes Start initialization... generate backend/config/main-local.php generate backend/config/params-local.php generate backend/web/index-test.php generate backend/web/index. php generate common/config/main-local.php generate common/config/params-local.php generate console/config/main-local.php generate console/config/params-local.php generate frontend/config/main-local.php generate frontend/config/params-local.php generate frontend/ web/index-test.php generate frontend/web/index. php generate tests/codeception/config/config-local.php generate yii generate cookie validation key in backend/config/main-local.php generate cookie validation key in frontend/config/main-local.php chmod 0777 backend/runtime chmod 0777 backend/ web/assets chmod 0777 frontend/runtime chmod 0777 frontend/web/assets chmod 0755 yii chmod 0755 tests/codeception/bin/yii... initialization completed. d: \ phpStudy \ WWW \ yii2 \ advanced>

5.2 complete database configuration. I chose mysql. Create the relevant database and configure the database. Open the common \ config \ main-local.php file under the yii2 directory, enter the user name, password, Database Name (no database name, you must first create a database name)
5.3 next, use yii migrate to create the built-in Database

D: \ phpStudy \ WWW \ yii2 \ advanced> yii migrate Yii Migration Tool (based on Yii v2.0.8) Total 1 new migration to be applied: m130524_201442_init Apply the above migration? (Yes | no) [no]: yes *** applying m130524_201442_init> create table {% user }}... done (time: 0.308 s) *** applied m130524_201442_init (time: 0.496 s) 1 migration was applied. migrated up successfully. d: \ phpStudy \ WWW \ yii2 \ advanced>

5.3.1 log on to the database and verify it. There should be two tables (migration/user) [Phantom of the wind 14:29:50]

Mysql> use yii2advanced Database changed mysql> show tables; + tables + | Tables_in_yii2advanced | + tables + | migration | user | + -------------------- + 2 rows in set (0.00 sec) mysql>

Mysql> desc user; + keys + -------------- + ------ + ----- + --------- + ---------------- + | Field | Type | Null | Key | Default | Extra | + keys + -------------- + ------ + ----- + --------- + ---------------- + | id | int (11) | NO | PRI | NULL | auto_increment | username | varchar (255) | NO | UNI | NULL | auth_key | varchar (32) | NO | NULL | password_hash | varchar (255) | NO | NULL | password_reset_token | varchar (255) | YES | UNI | NULL | email | varchar (255) | NO | UNI | NULL | status | smallint (6) | NO | 10 | created_at | int (11) | NO | NULL | updated_at | int (11) | NO | NULL | + ---------------------- + -------------- + ------ + ----- + --------- + ---------------- + 9 rows in set (0.00 sec) mysql> desc migration->; + ------------ + -------------- + ------ + ----- + --------- + ------- + | Field | Type | Null | Key | Default | Extra | + ------------ + ------ + ----- + --------- + ------- + | version | varchar (180) | NO | PRI | NULL | apply_time | int (11) | YES | NULL | + ------------ + -------------- + ------ + ----- + --------- + ------- + 2 rows in set (0.00 sec) mysql>

6. access now.

Http: // localhost/advanced/frontend/web/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.