ubuntu LNMP下 composer方式安装YII

in 默认分类 with 0 comment

1,假设LNMP已经搭建完毕
2,用非root账户登录系统,
3, 下载composer:curl -sS https://getcomposer.org/installer | php
4,移动到y目录:sudo mv composer.phar /usr/local/bin/composer
5,切换镜像到国内 : composer config -g repo.packagist composer https://packagist.phpcomposer.com
6,安装插件:composer global require "fxp/composer-asset-plugin:~1.1.1"
7,切换到 var/www/html/yii 目录下执行安装命令: composer create-project --prefer-dist yiisoft/yii2-app-basic

 此一步骤过程很长,需要等待

8,装到一半路特么居然提示要git的token,那就注册一个git账号,登录,直接在地址栏输入红框的地址,点击"Generate new token"

9,输入:描述

10,下面的选项全选,点击最下边的"Generate token "

11,copy标记的token,shift+insert 到shell提示的地方,按回车继续:

12,出现"token stored successfully"则成功继续安装,又是漫长的等...

8,测试:http://192.168.1.125/yii/yii2-app-basic/web/

注意:第6步容易出错,可能出现2种错误

        (1)这里版本一定是1.1.1否则很大概率出错
        (2)遇到类似儿的错误:PHP Fatal error:  Uncaught Error: Call to undefined method Composer\Package\RootPackage::getConfig(),尝试用以下命令解决: rm -rf ~/.composer/vendor/fxp )
         ( 3 ) 若之前安装过compose,可以暂时卸载,重新安装再执行第(2)步
Comments are closed.