环境阿里云
1.Linux 平台可以使用以下命令来安装:
复制到本地
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
安装
php composer-setup.php
All settings correct for using Composer
Downloading...
Composer (version 1.6.5) successfully installed to: /root/composer.phar
Use it: php composer.phar
移动 composer.phar,这样 composer 就可以进行全局调用:;
mv composer.phar /usr/local/bin/composer
2. 切换为国内镜像:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
执行时候可能遇到以下报错
PHP Warning: putenv() has been disabled for security reasons in phar:///usr/local/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 160
Warning: putenv() has been disabled for security reasons in phar:///usr/local/bin/composer/vendor/composer/xdebug-handler/src/Process.php on line 160
PHP Warning: putenv() has been disabled for security reasons in phar:///usr/local/bin/composer/bin/composer on line 57
Warning: putenv() has been disabled for security reasons in phar:///usr/local/bin/composer/bin/composer on line 57
函数putenv()被禁用了 ,而安装修改配置时用到了该函数
/usr/local/php/etc/php.ini进入编辑状态
输入/,进入搜索模式,找到disable_functions
寻找disable_functions字符串,将后面的putenv删除
3. 更新 composer:
composer selfupdate
4.查看版本
composer -V
网友评论