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

Two ways to install composer

藏色散人
Release: 2020-01-11 14:40:14
forward
2820 people have browsed it

The following tutorial column of composer will 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
Copy after login

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


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

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

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

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
Copy after login

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) # 让环境变量立即生效
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template