CentOS7下PHP73安装composer教程

  • 原文链接:
    https://www.wenknow.com/article/f3da6ec3cf1ecc5a1137cb238261594f4eef

php73命令问题

  • 由于之前装php的时候,php的命令名变成了php73,导致composer安装失败,可以通过以下命令解决
cp /usr/bin/php73 /usr/bin/php

安装composer

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

mv composer.phar /usr/local/bin/composer

切换为国内镜像:

#首先把默认的源给禁用掉
composer config -g secure-http false
#再修改镜像源 这里我使用阿里的源
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
#修改成功后可以先查看一下配置
composer config -g -l
#第二行repositories.packagist.org.url 如果是阿里的就代表成功

更新 composer:

composer selfupdate

你可能感兴趣的:(CentOS7下PHP73安装composer教程)