且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 4:Windows 8 XAMPP / WAMP上的安装错误

更新时间:2023-02-22 14:10:46

网络过滤器(特别是 K9 Web Protection )首先卸载并重试。如果问题仍然存在,请提前阅读:



问题是,Composer在第一个 https 后降级为 http 请求到服务器。这样做是为了提高性能/速度,并通过sha256哈希确保文件的完整性/安全性。在任何情况下,这将导致10053错误(errno = 10053已建立的连接中止
由主机中的软件...无法打开流:HTTP请求失败!)在一些机器上。



这种情况发生在一些人而不是其他人的原因似乎是你的ISP处理 http 请求的方式。在我的情况下,他们被重新路由通过缓存代理;这与Composer制作其 http 请求的方式不能很好地配合。这是我发生了什么 - 其他人可能有不同的原因。无论如何,修复方法是强制Composer使用 https 请求,而不是 http 请求:



跟随Composer安装的配置文件(composer.json)。在Windows中,您可以在C:\Users {您的用户名} \AppData\Roaming\Composer中找到此文件。

 repositories:[
{
packagist:false
},
{
type:composer,
url :https://packagist.org/
}
],

然后,再次按照您的尝试创建项目。它应该现在工作。


I am trying to install Laravel 4 but I keep geting this error. If you have any hints on how to solve it, I would appreciate your help.

Here is want i tried so far

  • enabled php extensions: php_openssl, php_curl, php_socket

  • In Apache Modules, enabled ssl_module

  • in the all php.ini files i enebaled openssl

  • Disabled Firewall


My configuration:

  • Windows 8
  • Using Git Bash
  • Tried on both XAMPP/WAMPP and i get the same error
  • Composer is installed

    $ composer create-project laravel/laravel project-v1 --prefer-dist
    
      [Composer\Downloader\TransportException]
      The "http://packagist.org/p/laravel/laravel$cfb9a31046c5c103d3b5e46a51b5a18
      a629de734f094f489e2b7df1420078c17.json" file could not be downloaded: send
      of 103 bytes failed with errno=10053 An established connection was aborted
      by the software in your host machine.
    
      send of 21 bytes failed with errno=10053 An established connection was abor
      ted by the software in your host machine.
    
      send of 113 bytes failed with errno=10053 An established connection was abo
      rted by the software in your host machine.
    
      send of 2 bytes failed with errno=10053 An established connection was abort
      ed by the software in your host machine.
    
      send of 2 bytes failed with errno=10053 An established connection was abort
      ed by the software in your host machine.
    
      failed to open stream: HTTP request failed!
    
    
    
    create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repos
    itory-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--n
    o-scripts] [--no-progress] [--keep-vcs] [--no-install] [package] [directory] [ve
    rsion]
    

First off, if you're running a web filter, especially K9 Web Protection, uninstall that first and retry. If the problem persists, read ahead:

The problem is that Composer downgrades to http requests after the first https request to the server. This is done to improve performance/speed and to ensure file integrity/security via the sha256 hashes. In any case, this will cause a 10053 error (errno=10053 An established connection was aborted by the software in your host machine ... failed to open stream: HTTP request failed!) on some machines.

The reason this happens to some people and not others seems to be the manner in which your ISP handles http requests. In my case, they're re-routed through a caching proxy; which doesn't work well with the way Composer crafts its http requests. That's what happened with me - others may have a different cause. In any case, the fix is to force Composer to use https requests instead of http requests:

Add the following to your Composer installation's config file (composer.json). In Windows, you may find this file at C:\Users{Your Username}\AppData\Roaming\Composer.

"repositories": [
{
    "packagist": false
},
{
    "type": "composer",
    "url": "https://packagist.org/"
}
],

Then go ahead and create your project again as you had attempted. It should work now.