laravel 我无法在 Ubuntu 16.04 中安装 php composer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39337127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I cannot install php composer in Ubuntu 16.04
提问by Manuel Sayago
I have this error when I try to install composer:
当我尝试安装 Composer 时出现此错误:
Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:
您机器上的某些设置使 Composer 无法正常工作。确保修复下面列出的问题并再次运行此脚本:
The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with --with-openssl
缺少 openssl 扩展,这意味着安全的 HTTPS 传输是不可能的。如果可能,您应该启用它或使用 --with-openssl 重新编译 php
I followed this steps from my terminal in the Downloads directory:
我从我的终端在下载目录中按照以下步骤操作:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Just like the website says. What can I do now? I'm using Laravel but I need composer first. I have seen on internet that it's something to do with extensions but I don't know how to it.
就像网站上说的那样。我现在能做什么?我正在使用 Laravel,但我首先需要作曲家。我在互联网上看到这与扩展有关,但我不知道如何去做。
Hope someone cal help me with this!
希望有人帮我解决这个问题!
Thanks in advance.
提前致谢。
回答by delatbabel
sudo apt-get install composer
... worked for me, and will additionally install all of the dependencies. Or, as @Jonathon mentions above, use the synaptic package manager to install composer. Note that this will get you the latest stable composer, not the devel version that you get from doing it on the command line from getcomposer.org
...对我来说有效,并将另外安装所有依赖项。或者,正如@Jonathon 上面提到的,使用突触包管理器来安装 composer。请注意,这将为您提供最新的稳定作曲家,而不是您从 getcomposer.org 在命令行上执行此操作所获得的开发版本
回答by Panditya Agrisyah P
Try this
尝试这个
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer
Related to this issue https://github.com/composer/composer/issues/5510. Hope it also fixes yours
与此问题相关的https://github.com/composer/composer/issues/5510。希望它也能解决你的问题
回答by Kumanan
I have installed composer by running few commands for my Ubuntu 16.04 - laravel PHP application server.
我已经通过为我的 Ubuntu 16.04 - laravel PHP 应用程序服务器运行几个命令来安装 Composer。
Setup in home directory :
在主目录中设置:
cd ~
Install Curl to get the composer library:
安装 Curl 以获取 composer 库:
sudo apt-get install curl
Installing composer:
安装作曲家:
sudo curl -s https://getcomposer.org/installer | php
Move the composer file to bin path :
将 Composer 文件移动到 bin path :
sudo mv composer.phar /usr/local/bin/composer
Verify composer installation :
验证 composer 安装:
composer