Laravel 4: Installation error on Windows 8 XAMPP/W

2019-01-28 13:09发布

问题:

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]
    

回答1:

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 on 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 to 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.



回答2:

It looks like you have some kind of firewall running on your local machine that is blocking the connection to download the required files.

You will need to shuffle through any security programs and check if any are blocking it.