laravel 适用于 Windows 的 Composer 安装 -

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22545257/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:14:15  来源:igfitidea点击:

Composer Install for Windows-

phplaravelwampcomposer-php

提问by Warlo

So I am trying to install Composer and setup Laravel on my Windows OS how ever I keep getting the same error when I run the install.

所以我试图在我的 Windows 操作系统上安装 Composer 并设置 Laravel,但我在运行安装时总是遇到相同的错误。

To start I selected php.exe as it asks from directory C:\wamp\bin\php\php5.4.16

要开始,我选择了 php.exe,因为它从目录中询问 C:\wamp\bin\php\php5.4.16

I click next, then install and it will go through like its install then stop and display the error:

我单击下一步,然后安装,它将像安装一样运行,然后停止并显示错误:

An error occurred. Clicking Retry may resolve this issue.
Connection error [ERR_CONNECTION]:Unable to connect to getcomposer.org

Request to http://getcomposer.org/installer failed with errors:
Failed to open stream: A connection attempt failed because the connected party 
did not properly respond after a period of time, or established connection failed 
because connection host has failed to respond.

Now I'm not sure if I have to sets something up or change something in the php.ini file to make this take place but from what I can tell the site getcomposer.org is unable to communicate with my PC as if I have a firewall up blocking it which my firewall is turned off at the time of installation.

现在我不确定是否必须在 php.ini 文件中设置或更改某些内容才能实现此目的,但据我所知,该站点 getcomposer.org 无法与我的 PC 通信,就好像我有一个防火墙阻止它,我的防火墙在安装时关闭。

I was unable to find a matching question on stack overflow or in any online search, so I went ahead and thought I'd ask to see if anyone can help out, thank you.

我无法在堆栈溢出或任何在线搜索中找到匹配的问题,所以我继续并想我会问是否有人可以提供帮助,谢谢。

回答by RiggsFolly

The PHP CLI ( Command Line Interface i.e running php from the command line ) uses a different php.ini to the one used by PHP under apache.

PHP CLI(命令行界面,即从命令行运行 php)使用的 php.ini 与 PHP 在 apache 下使用的不同。

Edit the php.ini file that is on your C:\wamp\bin\php\php5.4.16and make sure you have the extension php_openssland 'php_curl` enabled.

编辑您的 php.ini 文件C:\wamp\bin\php\php5.4.16并确保您php_openssl启用了扩展名和“php_curl”。

回答by Bielco

You can try in a console if pinging the composer.org website works, like so... ping composer.org, if that does not work that explains why the install fails.

如果 ping composer.org 网站有效,您可以在控制台中尝试,就像这样... ping composer.org,如果这不起作用,则说明安装失败的原因。