ubuntu18安装composer

2018-09-30 09:45:55       xhs
sudo apt update
sudo apt install curl php-cli php-mbstring git unzip
失败了
php -v
因为我装的是php7.3,,所以装php的扩展都应该带php7.3-
sudo apt install php7.3-curl
apt-cache search php7 | grep cli
sudo apt install php7.3-cli
sudo apt install php7.3-mbstring
安装git
sudo apt install git unzip
参考https://getcomposer.org/download/的 Command-line installation
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ls
php -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
//php composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"

如果上面运行的是
php composer-setup.php,那就最好把composer.phar拷到/usr/local/bin,后面执行方便
sudo cp composer.phar /usr/local/bin/composer
运行composer -V 确认安装是否成功

参考https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-18-04


发表评论