技术&日志

linux安装YII2

使用composer安装

1.安装comoposer(如果已经安装 更至最新 composer self-update)
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

2.使用composer安装YII需要的组件及框架

composer global require "fxp/composer-asset-plugin:^1.3.1"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic

3.测试安装结果

php yii serve --port=8888 #此种方式只能本机访问
http://127.0.0.1:8888 

安装过程记录

bower.json was found in any branch or tag of https://github.com/jquery/jquery-dist.git

1.vim composer.json # 添加下面一段配置

"config": {
        "process-timeout": 1800,
        "github-oauth": {
          "github.com": "此处输入您的github授权码"
          }
    },

2.获取github授权码

1) 点击 https://github.com/settings/tokens
2) 点击右上角 Generate new token
3) 在Token description中输入”可以任意”
4) 点击Generate token即可创建新的github授权码

将生成的授权码复制到 composer.json中的github.com对应的值中.

3.执行 composer update


Yii2.0 安装使用报错:cookieValidationKey
修改 config/web.php 文件,给 cookieValidationKey 配置项 添加一个密钥

'cookieValidationKey' => '随便自定义的一个字符串',

相关资料

YII官方网站
国内YII网站
中文安装文档
github 授权码