yii2的简单安装

yii2的简单安装

每到一个公司都有自己的php框架,目前没有和开源完全重合的。
一直想完整的读一个开源的php框架的代码,开源框架太多,最近选取yii作为分析对象

通过composer安装yii2

1 安装composer 我使用的是brew安装的

2 composer create-project –prefer-dist –stability=dev yiisoft/yii2-app-advanced ../yii2test

create-project创建一个项目
--prefer-dist: 当有可用的包时,从 dist 安装。
--stability 资源包的最低稳定版本,默认为 stable。
yiisoft/yii2-app-advanced 软件的名称
软件的路径../yii2test

安装时需要token,在github生成你的token https://github.com/settings/tokens

composer的详细说明

composer 安装yii2 安装了很多我不需要的,而且也不清楚代码里面的依赖

下载tar包

直接在http://www.yiiframework.com/download/下载下面地址的tar包

https://github.com/yiisoft/yii2/releases/download/2.0.10/yii-basic-app-2.0.10.tgz

yii运行环境准备

配置host

127.0.0.1 framework.yii2.kang.com 

配置nginx

 server {
          listen 80; 
          server_name  framework.yii2.kang.com;
          access_log  /Users/kang/Documents/var/log/access.log;
          #root /Users/kang/Documents/phpProject/studyphp/framework/yaf;
          root /Users/kang/Documents/phpProject/studyphp/framework/yii2;
          index  index.php index.html index.htm;
          location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                                                                                                      
            include        fastcgi_params;
            include         fastcgi.conf;
          }   
          if (!-e $request_filename) {
                rewrite ^/(.*)  /index.php/$1 last;
          }   
    } 

运行 http://framework.yii2.kang.com/requirements.php

记得在config里面加上cookieValidationKey即可

yii2的安装告一段落,下面我们开始下一段旅程。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值