1. 前提条件,php版本得> 5.4

D:\phpStudy>php -v
PHP 5.5. (cli) (built: Sep ::)
Copyright (c) - The PHP Group
Zend Engine v2.5.0, Copyright (c) - Zend Technologies D:\phpStudy>

2. 安装方式,一种是直接下载压缩包,推荐采用composer方式安装,未来的趋势。安装直接确保php已经支持openssl (php.ini)查找Openssl
2.1 下载安装composer , 我的环境是windows的 。

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

附:linux安装方式

[root@mty01 --]# curl -sS https://getcomposer.org/installer | php
Downloading 1.1....
Composer successfully installed to: /home/haozi/--/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.) is quite old, upgrading to PHP 5.3. or higher is recommended.
Composer works with 5.3.+ for most people, but there might be edge case issues.
The OpenSSL library (1.0.-fips) used by PHP does not support TLSv1. or TLSv1..
If possible you should upgrade OpenSSL to version 1.0. or above.
[root@mty01 --]# ls
composer.phar
[root@mty01 --]# du -sh composer.phar
1.6M composer.phar

3. 完成composer安装之后,需要安装composer的插件

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: %
Writing lock file
Generating autoload files
D:\phpStudy\WWW\yii2>

4. 开始安装之前,需要配置一个 github的token,这里不做叙述。意思是需要申请一个github的账号,然后生成一个token。
 参照如下路径,设置(注意下面xxxx明显是打码了,所以你直接使用用不了)

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.重头戏,开始安装。由于国内环境的问题,安装时间比较长,半个小时也常见,只要程序没死,不要切断.....

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

5.1 安装之后需要进行相关配置,初始化

D:\phpStudy\WWW\yii2\advanced>init
Yii Application Initialization Tool v1.
Which environment do you want the application to be initialized in?
[] Development
[] Production
Your choice [-, or "q" to quit]
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 backend/runtime
chmod backend/web/assets
chmod frontend/runtime
chmod frontend/web/assets
chmod yii
chmod tests/codeception/bin/yii
... initialization completed.
D:\phpStudy\WWW\yii2\advanced>

5.2 完成数据库的相关配置,我选择的是mysql。自己创建相关数据库,然后配置。打开yii2目录下的common\config\main-local.php文件,输入用户名,密码,数据库名字(没有数据库名,必须先创建数据库名字)
5.3 接下来使用yii migrate创建自带的数据库

D:\phpStudy\WWW\yii2\advanced>yii migrate
Yii Migration Tool (based on Yii v2.0.8)
Total 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: .308s)
*** applied m130524_201442_init (time: .496s)
migration was applied.
Migrated up successfully.
D:\phpStudy\WWW\yii2\advanced>

5.3.1 登陆数据库,验证一下。应该有2张表(migration / user)【幻风寒影 2016-07-11 14:29:50】

mysql> use yii2advanced
Database changed
mysql> show tables;
+------------------------+
| Tables_in_yii2advanced |
+------------------------+
| migration |
| user |
+------------------------+
rows in set (0.00 sec)
mysql>
mysql> desc user;
+----------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+--------------+------+-----+---------+----------------+
| id | int() | NO | PRI | NULL | auto_increment |
| username | varchar() | NO | UNI | NULL | |
| auth_key | varchar() | NO | | NULL | |
| password_hash | varchar() | NO | | NULL | |
| password_reset_token | varchar() | YES | UNI | NULL | |
| email | varchar() | NO | UNI | NULL | |
| status | smallint() | NO | | | |
| created_at | int() | NO | | NULL | |
| updated_at | int() | NO | | NULL | |
+----------------------+--------------+------+-----+---------+----------------+
rows in set (0.00 sec)
mysql> desc migration
-> ;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| version | varchar() | NO | PRI | NULL | |
| apply_time | int() | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
rows in set (0.00 sec)
mysql>

6. 现在可以开始访问了。

http://localhost/yii2/advanced/frontend/web/

7. 参照如上表格,默认自带了user管理(sign in / login /logout)不过默认没有用户,可以先注册,顺便验证一下。

yii2 advance 安装的更多相关文章

  1. yii2 advance安装

    转载自:http://www.genshuixue.com/i-cxy/p/7986531 1. 前提条件,php版本得> 5.4D:\phpStudy>php -v PHP 5.5.17 ...

  2. YII2 项目安装步骤及异常记录

    项目环境: 操作系统:windows 7 版本管理:git 该项目我是在mac上面创建的,mac上面的环境也是一波三折啊!但我同事的环境是在windows上面,因为是前端同学,所以只好我再次操刀了.. ...

  3. yii2 composer安装

    安装Yii2 1.安装composer 在命令行输入 curl-sS https://getcomposer.org/installer | php mv composer.phar /usr/loc ...

  4. yii2框架安装运行init.bat报错php.exe不是内部或外部命令

    在安装yii2框架的时候,遇到一个很纠结的问题.就是当我把安装包下载下来之后,在公司的电脑安装可以正常,当我回家用自己的电脑安装就报错,提示 php.exe 不是内部或外部命令,也不是可运行的程序.这 ...

  5. yii2.0安装ElasticSearch及使用

    yii2.0安装ElasticSearch安装及使用教程:https://www.yiichina.com/tutorial/1046 Elasticsearch 权威指南(中文版):https:// ...

  6. Yii2框架安装(windows)

    -->安装PHP环境Wamp集成环境,XAMMP等.-->安装Composerhttp://pan.baidu.com/s/1i3fejjvPS:安装过程中的有一个手动操作项选择php.e ...

  7. Yii2 手动安装yii2-imagine插件

    由于网络的原因使用composer安装Yii框架,实在太过痛苦,所以这里干脆就手动安装yii-imagine的扩展. 首先下载yii2-image和Imagine扩展库,点击链接就可以从百度云下载上传 ...

  8. PHP框架Yii2.0安装(基础版、高级版)

    最近农成也是切入了yiiframework 2.0,就是安装yii2.0就花费了不少的时间,为此做了很多的弯路,特此写一篇博文来给后面学习的同学少走一点的弯路.写的不好的地方欢迎各位学习的同学们能够指 ...

  9. yii2框架安装

    注意:先把php.ini里面的php_openssl.dll扩展打开 1.下载yii2框架的文件包yii-advanced-app-2.0.7 2.打开路径为advanced下面的init.bat   ...

随机推荐

  1. require.js 的使用

    一.为什么要用require.js 在同一个页面要加载多个js文件时,浏览器会停止网页渲染,加载文件越多,网页失去响应的时间就会越长: 其次,由于js文件之间存在依赖关系,因此必须严格保证加载顺序(比 ...

  2. 为什么项目的jar包会和tomcat的jar包冲突?

    为什么项目的jar包会和tomcat的jar包冲突? 碰到这个问题,猜测tomcat启动时会将自己的lib和项目的lib在逻辑上归并为一个大的lib,但是并没有做版本区分以及去重,这样相同的包可能就有 ...

  3. ROC曲线与AUC值

    本文根据以下文章整理而成,链接: (1)http://blog.csdn.net/ice110956/article/details/20288239 (2)http://blog.csdn.net/ ...

  4. MySQL(四) 数据表的插入、更新、删除数据

    序言 数据表的插入.更新.删除非常简单,但是简单的也要学习,细节决定成败. ---WH 一.插入数据 格式:INSERT INTO 表名(字段名...)VALUES(值...); 创建环境 使用per ...

  5. Request 接收参数乱码原理解析三:实例分析

    通过前面两篇<Request 接收参数乱码原理解析一:服务器端解码原理>和<Request 接收参数乱码原理解析二:浏览器端编码原理>,了解了服务器和浏览器编码解码的原理,接下 ...

  6. .NET知识结构

    .NET知识结构 .NET介绍 微软.NET战略及技术体系,.NET Framework框架类库(FCL),公共语言运行时(CLR),通用类型系统(CTS),公共语言规范(CLS),程序集(Assem ...

  7. 优化数据库的方法及SQL语句优化的原则

    优化数据库的方法: 1.关键字段建立索引. 2.使用存储过程,它使SQL变得更加灵活和高效. 3.备份数据库和清除垃圾数据. 4.SQL语句语法的优化.(可以用Sybase的SQL Expert,可惜 ...

  8. 补充$.extend()

    这里多谢某童鞋的提醒!说我的上篇随笔jquery插件开发的方式一还还可用于合并参数和深clone,虽然方式二中用了方式一做参数合并,但并未详细介绍,所以今天在此处做点补充! 一.合并参数 jquery ...

  9. 微信js SDK接口

    微信JS-SDK说明文档 http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html 一.微信登录功能 在进行微信OAut ...

  10. Angular 1与 Angular 2之间的一些差别

    现在在用ng1.5.8做一个项目,ng的优点和特性我就不用多说了,ng1在陆续更新到1.5/1.6后就没再推出新版本了,ng2已经面世测试很久了,如同很多系统和框架一样,每个大的版本更新都会有新特性加 ...