下载作曲家时我遇到了此类错误。
php composer-setup.php
All settings correct for using Composer
PHP Warning: file_put_contents(/home/vasu/.composer/keys.dev.pub): failed to open stream: Permission denied in /home/vasu/composer-setup.php on line 468
PHP Warning: file_put_contents(/home/vasu/.composer/keys.tags.pub): failed to open stream: Permission denied in /home/vasu/composer-setup.php on line 485
Downloading 1.2.0...
PHP Warning: openssl_verify(): supplied key param cannot be coerced into a public key in /home/vasu/composer-setup.php on line 576
PHP Warning: openssl_free_key() expects parameter 1 to be resource, boolean given in /home/vasu/composer-setup.php on line 577
Signature mismatch, could not verify the phar file integrity
答案1
简单的方法
首先尝试简单的方法。由于评论中提到的错误消息,本答案中包含了困难的方法。
sudo mkdir -p /usr/local/bin
sudo apt-get install curl
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
在 Ubuntu 16.04 及更高版本中,可以从默认的 Ubuntu 存储库安装 Composer。打开终端并输入:
sudo apt install composer
艰辛的道路
首先检查是否/usr/local/bin/
存在,如果不存在则创建/usr/local/bin/
目录。
sudo mkdir -p /usr/local/bin
如果/usr/local/bin/
已经存在,上述命令将不执行任何操作,除了返回此消息:
mkdir: cannot create directory ‘/usr/local/bin’: File exists
运行以下命令:
sudo chmod -R 755 /usr/local/bin/
cd /usr/local/bin/
ls # list the old composer file(s)
sudo rm <old-composer-files> # delete the old composer file(s)
sudo apt-get install curl
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
然后,如果您composer
在终端中输入,它将在您的系统中全局可访问。