Home>Article>Development Tools> Two ways to install composer

Two ways to install composer

藏色散人
藏色散人 forward
2020-01-11 14:40:14 2652browse

The following tutorial column ofcomposerwill introduce you to the two methods of composer installation. I hope it will be helpful to friends in need!

Two ways to install composer

##Two ways to install composer

Partial installation (valid only in specific projects)

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

//If various errors occur when running the above command, you can also run the following command


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

Use –install-dir= ” to specify the installation directory of composer

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

Global installation (can take effect anywhere on the machine)

curl -sS https://getcomposer.org/installer | php //获取composer mv composer.phar /usr/local/bin/composer composer //直接运行composer

If composer still cannot be installed anywhere For local execution, you need to add environment variables as follows:

vi /etc/profile export PATH=/usr/local/php5.6/bin/:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin source /etc/profile (or environment) # 让环境变量立即生效

For more composer-related technical articles, please visit the composer column:

//m.sbmmt.com/tool/composer/

The above is the detailed content of Two ways to install composer. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete