Yii2,学习新的框架,先从安装开始。 环境:Ubuntu 14 X 64 Yii2版本:basic

PHP版本必须在5.4.0以上!!!

先从在线用composer安装开始:

全局安装composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

修改中国源,不然会很慢,如果有梯子,可以略过。

composer config -g repositories.packagist composer http://packagist.phpcomposer.com

安装必备插件

composer global require "fxp/composer-asset-plugin:~1.0.0"

开启必须函数proc_open,不然会看到

  [Symfony\Component\Process\Exception\RuntimeException]
  The Process class relies on proc_open, which is not available on your PHP installation.

开启必须函数proc_get_status(),不然会看到

  [ErrorException]
  proc_get_status() has been disabled for security reasons

开启必须函数shell_exec(),不然会看到

 [ErrorException]
  shell_exec() has been disabled for security reasons

申请github token,其他项目也会用到,不然会看到

Could not fetch https://api.github.com/repos/jquery/jquery, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+mrgeneral-linux+2015-09-05+1450
to retrieve a token. It will be stored in "/home/chengxiaobai/.composer/auth.json" for future use by Composer.
Token (hidden):

安装Yii2 basic

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

不出意外会出现

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 >=2.0.5 -> satisfiable by yiisoft/yii2[2.0.5, 2.0.6].

因为http://www.yiichina.com/doc/guide/2.0/start-installation这里写的没有版本号啊!摔!

正确的在http://www.yiichina.com/download写着,上面的文档中没有一并更新。 英文官网http://www.yiiframework.com/download/写的也是正确的。

composer create-project yiisoft/yii2-app-basic basic 2.0.6

都处理完后看见这个就代表成功了。

fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.

离线包,简单粗暴,哈哈: basic版 advanced版

本作品由 程小白 创作,采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可,可自由转载、引用但需署名作者且注明文章出处。
原文地址:https://www.chengxiaobai.cn/php/yii2-installation.html