Home > Article > Development Tools > Two ways to install composer
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
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');" | phpUse –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 //直接运行composerIf 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:
https://www.php.cn/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!