PHP Composer 安装
系统需求:
Composer 需要PHP5.3.2+ 以上的环境来运行。有几个敏感的PHP设置和编译标志也是必需的,但安装程序会发出警告当存在任何不兼容的情况。
比如PHP的扩展的要求是,安装或重新编译php without –disable-phar
为了从源地址安装软件包,而不是简单的压缩文件包,您将需要安装软件包的版本控制工具,比如git、svn或hg等。
Composer 是兼容多平台的,其运行适用于Windows,Linux和OSX。
安装失败的错误消息:
curl -sS https://getcomposer.org/installer | PHP #!/usr/bin/env php some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:The phar extension is missing. Install it or recompile php without –disable-pharYour PHP (5.2.9) is too old, you must upgrade to PHP 5.3.2 or higher.
我的本地默认开发环境是PHP 5.2.9,当我尝试在PHP 5.2.9上安装时,提示版本过低,需要升级到PHP 5.3.2 或者更高的版本。
于是我下载XAMPP 1.7.7 usb lite 版本。
E:/USB/Dropbox/phpstorm/php53>E:/USB/xampp_177/php/php.exe -v PHP 5.3.8 (cli) (built: Aug 23 2011 11:50:20) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
XAMPP 1.7.7 下的PHP环境是5.3.8。确认我的PHP环境大于等于PHP5.3.2后。
PHP 5.3 安装 Composer
E:/USB/Dropbox/phpstorm/php53>curl -sS https://getcomposer.org/installer | E:/USB/xampp_177/php/php.exe #!/usr/bin/env php Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following:The openssl extension is missing, which will reduce the security and stability o f Composer. If possible you should enable it or recompile php with –with-opensslDownloading…Composer successfully installed to: E:/USB/Dropbox/phpstorm/php53/composer.phar Use it: php composer.phar
注意:
我关闭了XAMPP 1.7.7 Apache的SSL模块,所以Composer提示我警告,为了安全因素建议我开启SSL模块。不开启也不影响使用。
安装时的参数 | PHP,一定要更改为真实的PHP环境路径,比如 | E:/USB/xampp_177/php/php.exe
使用Composer为PHP路径 + 命令,在我们安装的环境中,使用方法为:E:/USB/xampp_177/php/php.exe composer.phar 命令。
我安装的环境是在Windows下,如果在Linux下,而PHP 5.3 环境也不在默认PHP命令下时,应该采用 | /usr/php/53/usr/bin/php,例如:
curl -sS https://getcomposer.org/installer | /usr/php/53/usr/bin/php
安装完成后,检查安装版本。
E:/USB/Dropbox/phpstorm/php53>E:/USB/xampp_177/php/php.exe composer.phar -V Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33
新闻热点
疑难解答