Yii2无法使用composer创建新项目

时间:2013-12-12 21:09:50

标签: php yii

我的php版本是5.4.6,在下载了作曲家的最后一个快照后,我无法创建新项目和更新作曲家版本。

php composer.phar create-project --stability = dev yiisoft / yii2-app-basic basic

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version.

  [Composer\Downloader\TransportException]                                                      
  The "https://packagist.org/packages.json" file could not be downloaded: Failed to enable crypto  
  failed to open stream: operation failed                                                       



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [package] [directory] [version]     

php composer.phar自我更新

  [Composer\Downloader\TransportException]                                                      
  The "https://getcomposer.org/version" file could not be downloaded: Failed to enable crypto  
  failed to open stream: operation failed                                                       

self-update

1 个答案:

答案 0 :(得分:1)

Yii2安装


(1)首先安装Composer(LINUX):

<强> 本地:

curl -sS https://getcomposer.org/installer | PHP

php -r“readfile('https://getcomposer.org/installer');” | PHP

curl -sS https://getcomposer.org/installer | php - --install-dir = bin

<强> 全局:

curl -sS https://getcomposer.org/installer | PHP

mv composer.phar / usr / local / bin / composer

(1)首次安装Composer(WINDOWS):

C:\ Users \ username&gt; cd C:\ bin

C:\ bin&gt; php -r“readfile('https://getcomposer.org/installer');” | PHP

注意:如果由于readfile导致上述操作失败,请使用http url或在php.ini中启用php_openssl.dll

C:\ bin&gt; echo @php“%~dp0composer.phar”%&gt; composer.bat *

C:\ Users \ username&gt; composer -V 作曲家版本27d8904


(2)Yii2框架在线下载:

基本应用: php composer.phar create-project yiisoft / yii2-app-basic basic 2.0.0-beta

高级应用: php composer.phar create-project yiisoft / yii2-app-advanced advanced 2.0.0-beta


(3)其他应用设置命令:

php init

注意:设置DB Cofig common / config / local-main.php

php yii migrate


<强> REFFERENCE:

http://stuff.cebe.cc/yii2docs/guide-start-installation.html

https://github.com/yiisoft/yii2/tree/master/apps/advanced