在Ubuntu上安装Composer

我正在尝试使用以下命令安装作曲者:

sudo curl -s https://getcomposer.org/installer | php 

我得到这个错误:

 All settings correct for using Composer Downloading... Download failed: failed to open stream: Permission denied Downloading... Download failed: failed to open stream: Permission denied Downloading... Download failed: failed to open stream: Permission denied The download failed repeatedly, aborting. 

我不知道为什么? 你有好主意吗? 我尝试谷歌,但没有。

你的curl命令是以root身份(通过sudo)运行,但是你的php命令不是。 尝试在pipe道(“|”)和“php”之间移动你的sudo(假设你想让你的安装程序以root身份运行)。