win10使用Composer-Setup安装Composer以及使用Composer安装Yii2最新版

Posted caigan的技术博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win10使用Composer-Setup安装Composer以及使用Composer安装Yii2最新版相关的知识,希望对你有一定的参考价值。

1:下载 ca-bundle.crt和cacert.pem(见导航栏——文件)

将这两个文件放在php目录下

2:php.ini中添加上述两个文件的路径

curl.cainfo=C:/xampp/php/ca-bundle.crt
openssl.cafile=C:/xampp/php/ca-bundle.crt

写到最后一行就可以

3:下载Composer-Setup.exe

https://getcomposer.org/download/

在该页面找到Composer-Setup.exe并下载安装(要求能vpnFQ)

4:安装如果出现错误

Notice: Undefined variable: caBundle in - on line 892

出现该错误的时候,找到错误路径打开install文件,找到892行

红线的地方报caBundle未定义,手动改成如下:

改完之后保存文件,并且退出Composer-Setup.exe(不要继续安装),然后重新安装,不报错,走完安装过程

5:验证安装结果:

6:安装Yii2

在服务器上建立访问目录yii2,

在github的个人信息的设置上生成一个token,后面创建项目的时候提示token(hidden)的时候将这个token复制上去

参照

http://www.yiiframework.com/download/

安装Yii2的最新版本,

注意要将下面这两行创建命令

php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.6
改为:
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project yiisoft/yii2-app-basic basic 2.0.6
如果是advanced项目:
composer create-project yiisoft/yii2-app-advanced advanced 2.0.6

然后等待安装,cmd显示如下:

Microsoft Windows [版本 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved.

C:\\Users\\jzzq>cd C:\\xampp\\htdocs\\yii2

C:\\xampp\\htdocs\\yii2>php composer.phar global require "fxp/composer-asset-plugin:~1.1.1" Could not open input file: composer.phar

C:\\xampp\\htdocs\\yii2>composer self-update You are already using composer version 03299ff075236be27be356498d6c64def973fe41.

C:\\xampp\\htdocs\\yii2>php composer.phar global require "fxp/composer-asset-plugin:~1.1.1" Could not open input file: composer.phar

C:\\xampp\\htdocs\\yii2>composer global require "fxp/composer-asset-plugin:~1.1.1" Changed current directory to C:/Users/jzzq/AppData/Roaming/Composer Deprecation Notice: The Composer\\Package\\LinkConstraint\\MultiConstraint class is deprecated, use Composer\\Semver\\Constraint\\MultiConstraint instead. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/LinkConstraint/MultiConstraint.php:17 Deprecation Notice: The Composer\\Package\\LinkConstraint\\LinkConstraintInterface interface is deprecated, use Composer\\Semver\\Constraint\\ConstraintInterface instead. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17 ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)   - Removing fxp/composer-asset-plugin (v1.0.3)   - Installing fxp/composer-asset-plugin (v1.1.1)     Downloading: 100%

Writing lock file Generating autoload files

C:\\xampp\\htdocs\\yii2>php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.6 Could not open input file: composer.phar

C:\\xampp\\htdocs\\yii2>composer create-project yiisoft/yii2-app-basic basic 2.0.6 Installing yiisoft/yii2-app-basic (2.0.6)   - Installing yiisoft/yii2-app-basic (2.0.6)     Loading from cache

Created project in basic Loading composer repositories with package information Installing dependencies (including require-dev)   - Installing yiisoft/yii2-composer (2.0.3)     Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)     Loading from cache

  - Installing bower-asset/jquery (2.1.4)     Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.5)     Loading from cache

  - Installing bower-asset/punycode (v1.3.2)     Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)     Loading from cache

  - Installing cebe/markdown (1.1.0)     Loading from cache

  - Installing yiisoft/yii2 (2.0.6)     Loading from cache

  - Installing swiftmailer/swiftmailer (v5.4.1)     Loading from cache

  - Installing yiisoft/yii2-swiftmailer (2.0.4)     Loading from cache

  - Installing yiisoft/yii2-codeception (2.0.4)     Loading from cache

  - Installing bower-asset/bootstrap (v3.3.5)     Loading from cache

  - Installing yiisoft/yii2-bootstrap (2.0.5)     Loading from cache

  - Installing yiisoft/yii2-debug (2.0.5)     Loading from cache

  - Installing bower-asset/typeahead.js (v0.10.5)     Loading from cache

  - Installing phpspec/php-diff (v1.0.2)     Loading from cache

  - Installing yiisoft/yii2-gii (2.0.4)     Loading from cache

  - Installing fzaninotto/faker (v1.5.0)     Loading from cache

  - Installing yiisoft/yii2-faker (2.0.3)     Loading from cache

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.

C:\\xampp\\htdocs\\yii2>composer create-project yiisoft/yii2-app-advanced advanced 2.0.6 Installing yiisoft/yii2-app-advanced (2.0.6)   - Installing yiisoft/yii2-app-advanced (2.0.6)     Downloading: 100%

Created project in advanced Loading composer repositories with package information Installing dependencies (including require-dev)   - Installing yiisoft/yii2-composer (2.0.3)     Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)     Loading from cache

  - Installing cebe/markdown (1.1.0)     Loading from cache

  - Installing bower-asset/jquery (2.1.4)     Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)     Loading from cache

  - Installing bower-asset/punycode (v1.3.2)     Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.5)     Loading from cache

  - Installing yiisoft/yii2 (2.0.6)     Loading from cache

  - Installing swiftmailer/swiftmailer (v5.4.1)     Loading from cache

  - Installing yiisoft/yii2-swiftmailer (2.0.4)     Loading from cache

  - Installing yiisoft/yii2-codeception (2.0.4)     Loading from cache

  - Installing bower-asset/bootstrap (v3.3.5)     Loading from cache

  - Installing yiisoft/yii2-bootstrap (2.0.5)     Loading from cache

  - Installing yiisoft/yii2-debug (2.0.5)     Loading from cache

  - Installing bower-asset/typeahead.js (v0.10.5)     Loading from cache

  - Installing phpspec/php-diff (v1.0.2)     Loading from cache

  - Installing yiisoft/yii2-gii (2.0.4)     Loading from cache

  - Installing fzaninotto/faker (v1.5.0)     Loading from cache

  - Installing yiisoft/yii2-faker (2.0.3)     Loading from cache

fzaninotto/faker suggests installing ext-intl (*) Writing lock file Generating autoload files

C:\\xampp\\htdocs\\yii2>

以上是关于win10使用Composer-Setup安装Composer以及使用Composer安装Yii2最新版的主要内容,如果未能解决你的问题,请参考以下文章

安装composer

如何安装Composer

win10环境下使用python安装tensorflow

win7安装composer

安装composer

win10安装elasticsearch