php 连接中断。页面加载时与服务器的连接被重置

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

Connection Interrupted. The connection to the server was reset while the page was loading

phpmysqlfirefox

提问by Raul

I am calling a PHP-Script belonging to a MySQL/PHP web application using FF3. I run XAMPP on localhost. All I get is this:

我正在使用 FF3 调用属于 MySQL/PHP Web 应用程序的 PHP 脚本。我在本地主机上运行 XAMPP。我得到的只是这个:

Connection Interrupted
The connection to the server was reset while the page was loading. The network link was interrupted while negotiating a connection. Please try again.

连接中断
在加载页面时重置了与服务器的连接。协商连接时网络链接中断。请再试一次。

回答by DevByStarlight

There are a number of possible solutions ... depends on the "why" ... so it ends up being a bit of trial and error. On a fresh install, that's tricky to determine. But, if you made a recent "major" change that's a place to start looking - like modifying virtual hosts or adding/enabling XDebug.

有许多可能的解决方案......取决于“为什么”......所以它最终会有点反复试验。在全新安装时,这很难确定。但是,如果您最近进行了“重大”更改,那么您可以从这里开始寻找——例如修改虚拟主机或添加/启用 XDebug。

Here's a list of things I've used/done/tried in the past

这是我过去使用/做过/尝试过的事情的列表

  • check for infinite loops ... in particular looping through a SQL fetch result which works 99% of the time except the 1% it doesn't. In one case, I was using the results of two previous queries as the upper and lower bounds of a for loop ... and occasionally got a upper bound of a UINT max ... har har har (vomit)

  • copying the ./php/libmysql.dll to the windows/system32 directory (Particularly if you see Parent: child process exited with status 3221225477 -- Restartingin your log files ... check out: http://www.java-samples.com/showtutorial.php?tutorialid=1050)

  • if you modify PHP's error_reporting at runtime ... in certain circumstances this can cause PHP to degenerate into an unstable state if, say, in your PHP code you modify the superglobals or fiddle around with other deep and personal background system variables (Nah, who would ever do such evil hackery? ahem)

  • if you convert your MySQL to something other than MyISAM or mysqli

  • 检查无限循环……特别是循环遍历 SQL 获取结果,该结果在 99% 的情况下都有效,只有 1% 的情况下无效。在一种情况下,我使用前两个查询的结果作为 for 循环的上限和下限……偶尔会得到 UINT max 的上限…… har har har ( vomit)

  • 将 ./php/libmysql.dll 复制到 windows/system32 目录(特别是如果您Parent: child process exited with status 3221225477 -- Restarting在日志文件中看到...请查看:http: //www.java-samples.com/showtutorial.php? tutorialid=1050 )

  • 如果您在运行时修改 PHP 的 error_reporting ...在某些情况下,这可能会导致 PHP 退化为不稳定状态,例如,如果在您的 PHP 代码中修改超全局变量或摆弄其他深层和个人背景系统变量(不,谁会做这种邪恶的黑客吗?

  • 如果您将 MySQL 转换为 MyISAM 或 mysqli 以外的其他内容

There is a known bug with MySQL related to MyISAM, the UTF8 character set and indexes (http://bugs.mysql.com/bug.php?id=4541) Solution is to use InnoDB dialect (eg sql set GLOBAL storage_engine='InnoDb';)

MySQL 存在一个与 MyISAM、UTF8 字符集和索引相关的已知错误 (http://bugs.mysql.com/bug.php?id=4541) 解决方案是使用 InnoDB 方言(例如 sql set GLOBAL storage_engine='InnoDb';

  • Doing that changes how new tables are created ... which might slightlyalter the way results are returned to a fetch statement ... leading to an infinite loop, a malformed dataset, etc. (although this change should not hang the database itself)
  • 这样做会改变新表的创建方式……这可能会稍微改变将结果返回到 fetch 语句的方式……导致无限循环、格式错误的数据集等(尽管此更改不应挂起数据库本身)

Other helpful items are to ramp up the debug reporting for PHP and apache in their config files and restart the servers. The log files sometimes give a clue as to at least wherethe problem might reside. If it happens after your page content was finished it's more likely in the php settings. If it's during page construction, check your PHP code. Etc. etc.

其他有用的项目是在其配置文件中增加 PHP 和 apache 的调试报告并重新启动服务器。日志文件有时至少会提供有关问题可能存在于何处的线索。如果它发生在您的页面内容完成后,则更有可能是在 php 设置中。如果是在页面构建期间,请检查您的 PHP 代码。等等等等。

Hope the above laundry list helps somebody someday ... probably myself when I run into it again and come back here looking for "how the heck did I fix it last time?" ... :)

希望上面的洗衣清单总有一天能帮助某人......当我再次遇到它并回到这里寻找“我上次如何解决它时可能是我自己?” ... :)

回答by VirtuosiMedia

It's possible that your script could be caught in an infinite loop. If that doesn't apply, then I'd check the error logs like TimB suggested.

您的脚本可能陷入无限循环。如果这不适用,那么我会检查像 TimB 建议的错误日志。

回答by TimB

It sounds like the PHP script you're calling is failing without returning a valid response. Depending on the level of logging that you have set up, this should generate an error in the Apache logfile, which will give you some idea of the problem. I'm not familiar with XAMPP, but you should be able to find out where the logs are, and look for an error that occurred at the time you made your request to the PHP script.

听起来您正在调用的 PHP 脚本在没有返回有效响应的情况下失败了。根据您设置的日志记录级别,这应该会在 Apache 日志文件中生成一个错误,这将使您对问题有所了解。我不熟悉 XAMPP,但您应该能够找出日志的位置,并查找在您向 PHP 脚本发出请求时发生的错误。

回答by tata9999

copying libmysql.dll to apache\bin folder may help you overcome this strange error

将 libmysql.dll 复制到 apache\bin 文件夹可能会帮助您克服这个奇怪的错误

回答by Raul

I solved this problem Upgrading the xampp\php\ext\xdebug\php_xdebug.dll(changed to php xdebug v.2.0.5-5.3-vc9 )

我解决了这个问题升级 xampp\php\ext\xdebug\php_xdebug.dll(改为 php xdebug v.2.0.5-5.3-vc9 )

回答by shawndreck

I had the same problem and this is what i did.

我有同样的问题,这就是我所做的。

I issued the http get command through php cli script, and as it turns out I had declared one class twice somewhere.

我通过 php cli 脚本发出了 http get 命令,结果我在某处两次声明了一个类。

By the way , i use AMPPS on an mac

顺便说一下,我在 mac 上使用 AMPPS

Hope this helps some one!

希望这对某人有所帮助!

回答by Augustine Arthur

copying libmysql.dllto apache\binfolder may help you overcome this strange error

复制libmysql.dllapache\bin文件夹可能会帮助您克服这个奇怪的错误

Indeed this helped me to solve this problem

确实这帮助我解决了这个问题

The connection to the server was reset while the page was loading.

在加载页面时重置了与服务器的连接。

回答by young pac

Incase the issue is not working this did the trick for me. 1. I got a new zip directory for PHP and connected it with apache 2. I searched for the libmysql in the new php and inserted this to the apache/bin its this libmysql.dll that is needed there and not the one form mySQL/bin.

如果问题不起作用,这对我有用。1. 我为 PHP 获得了一个新的 zip 目录并将其与 apache 连接 2. 我在新的 php 中搜索了 libmysql 并将其插入到 apache/bin 中,它是那里需要的 libmysql.dll,而不是 mySQL/斌。

ok at least thats the one that worked.

好的,至少那是有效的。

回答by Gavin G

I experienced a very similar issue - which doesn't apply to the person who asked this question - but may be of help to others who are reading this page...

我遇到了一个非常相似的问题 - 这不适用于提出这个问题的人 - 但可能对正在阅读此页面的其他人有所帮助......

I had an issue where in certain cases PHP 5.4 + eAccelerator = connection reset. There was no error output in any log files, and it only happened on certain URLs, which made it difficult to diagnose. Turns out it only happened for certain PHP code / certain PHP files, and was due to some incompatibilities with specific PHP code and eAccelerator. Easiest solution was to disable eAccelerator for that specific site, by adding the following to .htaccess file

我遇到了一个问题,在某些情况下 PHP 5.4 + eAccelerator = 连接重置。任何日志文件中都没有错误输出,并且只发生在某些 URL 上,这使得诊断变得困难。原来它只发生在某些 PHP 代码/某些 PHP 文件中,并且是由于与特定 PHP 代码和 eAccelerator 的某些不兼容。最简单的解决方案是禁用该特定站点的 eAccelerator,方法是将以下内容添加到 .htaccess 文件

php_flag eaccelerator.enable 0

php_flag eaccelerator.enable 0

php_flag eaccelerator.optimizer 0

php_flag eaccelerator.optimizer 0

(or equivalent lines in php.ini):

(或 php.ini 中的等效行):

eaccelerator.enable="0"

eaccelerator.enable="0"

eaccelerator.optimizer="0"

eaccelerator.optimizer="0"

回答by dirtside

Try doing the request with Firebug enabled and see what info you can get out of that; I always find that using wget is helpful for seeing the raw HTTP interaction without worrying about Firefox's UI elements interfering.

尝试在启用 Firebug 的情况下执行请求,看看您可以从中获得哪些信息;我总是发现使用 wget 有助于查看原始 HTTP 交互,而不必担心 Firefox 的 UI 元素会干扰。