Yii2未能与composer一起创建新项目


Yii2 failed create new project with composer

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

php composer.phar创建项目--稳定性=dev-yiisoft/yii2-app基本

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

Yii2安装


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

本地:

卷曲-sShttps://getcomposer.org/installer|php

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

卷曲-sShttps://getcomposer.org/installer|php----install dir=bin

全球:

卷曲-sShttps://getcomposer.org/installer|php

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

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

C:''Users''username>cd C:''bin

C:''bin>php-r"readfile('https://getcomposer.org/installer');"|php

注意:如果由于读取文件而导致上述操作失败,请使用http url或在php.ini 中启用php_opensl.dll

C:''bin>echo@php"%~dp0composer.phar"%>composer.bat*

C:''Users''username>composer-V作曲家版本27d8904


(2)Yii2框架在线下载:

基本应用程序: php composer.phar创建项目yiisoft/yii2应用程序基本2.0.0-beta

高级应用程序: php composer.phar创建yiisoft/yii2应用程序高级2.0.0-beta项目


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

php-init

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

php-yii-migrate


参考:

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

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