且构网

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

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

更新时间:2023-02-22 14:23:22

首先,如果您正在运行 Web 过滤器,尤其是 K9 Web Protection,请先卸载该过滤器并重试.如果问题仍然存在,请继续阅读:

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

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

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.

这种情况发生在某些人身上而不是其他人身上的原因似乎是您的 ISP 处理 http 请求的方式.就我而言,它们是通过缓存代理重新路由的;这不适用于 Composer 制作其 http 请求的方式.这就是发生在我身上的事情——其他人可能有不同的原因.无论如何,解决方法是强制 Composer 使用 https 请求而不是 http 请求:

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:

将以下内容添加到您的 Composer 安装配置文件 (composer.json).在 Windows 中,您可以在 C:Users{Your Username}AppDataRoamingComposer 找到此文件.

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

"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.