symfony2 出现 ERR_CONNECTION_RESET,但 PHP 脚本不出现 ERR_CONNECTION_RESET
我目前正在使用 Symfony 开发一个 Web 应用程序,该应用程序应该连接到远程 Web 服务。然后将数据库从客户端同步到服务器,反之亦然,还有一些其他的废话。
Web 服务服务器位于 LAN 中的 IIS 上。 Symfony2 在我的机器上与 Wamp 一起运行。
因此,简单的 php 脚本中与 Web 服务的连接和请求代码功能非常完善。或者至少,它做了我想做的事。 与 IIS 服务器的任何连接都完全正常。 虽然有点慢,但是机器很乱。
现在我将相同的代码放入 Symfony2 类中,然后地狱就来了。 当我尝试加载该页面时,我得到一个
101 错误 (ERR_CONNECTION_RESET)
Web 服务服务器的日志指示登录、请求和响应已发送。 所以我的猜测是问题出在我的机器上,但不太确定。
真正有趣的是:我设法让它工作了大约 10 次。 然后又是101...
我禁用了Windows 7 LAN防火墙两侧,结果相同。
任何线索都非常受欢迎。 谢谢。
I am currently developing a web application with Symfony that's supposed to connect to a remote Web-Service. Then synchronise database from the client to the server and vice-versa and some other crap.
The Web-service server is on an IIS in the LAN.
Symfony2 is running with Wamp on my machine.
So, the connexion and request code to the web-service in a simple php script is perfectly functional. Or at least, it does what I want it to do.
And any connexion to the IIS server is perfectly fine.
A bit slow though, but the machine is quite a mess.
Now I put that same code into a Symfony2 class, and here comes the hell.
When I try to load that page, I get a
101 error (ERR_CONNECTION_RESET)
Web-service server's log indicates me that the login, request and response were sent.
So my guess is the problem is comin' from my machine, but not quite sure about it.
The really funny thing : I somehow managed to make it work for about 10 times.
Then 101 again...
I disabled the Windows 7 LAN firewall both side, same result.
Any clue is very welcome.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我和一位同事花了几个小时调试这个问题。他遇到了同样的错误,但它在我的机器上正常工作(我们使用的是 Windows 7,64 位,WAMPServer 2.2d,32 位)。
罪魁祸首是这样的:
- 文件 TwigEngine.php 在我的机器上有 Unix 风格的行结尾 (LF),但在他的机器上它有 Windows 风格的行结尾 (CR+LF)
- 仅将行结尾更改为 LF 后,它在他的机器上也运行良好
这可能会解释上面的其他答案“我需要做的只是重新保存
TwigBundle/TwigEngine.php”,如果编辑器更改了行结尾的格式。
根本原因是安装了 git,他选择了默认值(“Windows 风格的签出”),而我选择了“原样” )。
经过更多研究,这是对此原因的解释:https://github.com/symfony/symfony/issues/3216
希望这可以帮助其他人节省一些时间。
I spent hours debugging this with a colleague. He was getting the same error but it was working properly on my machine (we're using Windows 7, 64bit, WAMPServer 2.2d, 32bit).
Here is what the culprit was:
- the file TwigEngine.php had Unix-style line endings (LF) on my machine but on his machine it had Windows-style line endings (CR+LF)
- after changing the line endings to LF only, it works fine on his machine too
That would possibly explain the other answer above "all I needed to do is just resave
TwigBundle/TwigEngine.php" if the editor changed the format of the line endings.
The underlying cause was the installation of git, he had picked the default ("Windows-style check-outs") and I had selected "as-is").
After some more research. here is an explanation of the cause for this: https://github.com/symfony/symfony/issues/3216
Hopefully this helps someone else save some time.
我解决了问题...
我将 app_dev.php 中 AppKernel 的第二个参数设置为 FALSE,现在工作正常
我将继续调查...
I solve the problem...
I set the second parameter of AppKernel in app_dev.php to FALSE and now works fine
I will continue investigating...
经过 4 小时的“调试”后,我遇到了同样的问题,我发现我所需要做的就是重新保存
TwigBundle/TwigEngine.php
我不知道为什么
I had same problem after 4 hours of "debuging" i found that all I needed to do is just resave
TwigBundle/TwigEngine.php
I have no clue why
事实上,我认为(至少就我而言)这些错误与树枝有关。
有时,当 app/logs/dev.log 中出现与 twig 相关的严重错误时,我会得到 101。
这些严重错误通常是语法错误,因此这里没有什么实际意义。
一旦解决了,就没有问题了。
奇怪的是,有时,清除缓存可以让我加载页面 3 或 4 次。
In fact, I think (in my case at least) those errors are twig related.
Sometimes, when there's a critical error related to twig logged in app/logs/dev.log, I got that 101.
Those critical errors are often syntaxic, so no real deal here.
And once they are dealt with, no problem anymore.
The strange thing is that sometimes, clearing the cache allows me to load the page 3 or 4 times.
迈克·WP 成功了。 TwigEngine 需要 LF 行尾才能正常工作。您可以使用此控制台命令,然后您必须更新/重新安装供应商。
git config --global core.autocrlf 输入
Mike WP made it. TwigEngine need LF line endings to work properly. You can use this console command then you'll have to update/reinstall vendors.
git config --global core.autocrlf input
我在使用 XAMPP 的 Windows 上遇到了同样的问题,并通过以下方式解决:
I had the same issue on Windows using XAMPP, and solved by: