【发布时间】:2012-03-21 20:17:44
【问题描述】:
问题
当我执行以下代码时(我正在调用一个带有 5 个 IN 参数和 1 个 OUT 参数的存储过程)
$conn->query("SET @res = ''");
$mysqli=$conn;
if (!($stmt = $mysqli->prepare("CALL retrieve_matches(5,3, 16, 2, false, @res)"))) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
do {
if ($res = $stmt->get_result()) { //Apache crash on this call
printf("---\n");
var_dump(mysqli_fetch_all($res));
mysqli_free_result($res);
} else {
if ($stmt->errno) {
echo "Store failed: (" . $stmt->errno . ") " . $stmt->error;
}
}
} while ($stmt->more_results() && $stmt->next_result());
apache 因错误而崩溃:
AH00428:父进程:子进程 9628 以状态 255 退出 -- 正在重新启动。
我尝试了什么
- 此代码运行良好,并且可以正确返回结果:
$conn->query("SET @res = ''");
$res=$conn->query("CALL retrieve_matches(5,3, 16, 2, false, @res)");
var_dump($res->fetch_assoc());
注意:如果我只是更改存储过程的输入中的数字,则上述使 Apache 崩溃的相同代码可以正常工作,例如:
if (!($stmt = $mysqli->prepare("CALL retrieve_matches(5,6, 16, 2, false, @res)"))) {
- 从 MySQl 工作台尝试过,两个调用都运行良好。
- 我在 WIN7 Enterprise 64b 上使用 WAMP 64b,我尝试使用 WAMP 32b 但遇到了同样的问题。
- 我检查了windows事件,发现httpd.exe崩溃是由php5ts.dll引起的
- 如果你在谷歌上搜索“httpd.exe php5ts.dll”,你会发现很多人都遇到过这个问题。但我没有找到 WAMP 的解决方案...
- 用 AMPPS 试过,问题一模一样
PHP 错误日志
[10-Jul-2015 15:30:03 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:/Program Files/wamp/bin/php/php5.5.12/ext/php_ldap.dll' - Impossibile trovare il modulo specificato.
in Unknown on line 0
[10-Jul-2015 15:30:04 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:/Program Files/wamp/bin/php/php5.5.12/ext/php_intl.dll' - Impossibile trovare il modulo specificato.
APACHE 错误日志:
[Tue Jul 14 15:02:13.038276 2015] [mpm_winnt:notice] [pid 7044:tid 404] AH00428: Parent: child process 9448 exited with status 255 -- Restarting.
[Tue Jul 14 15:02:13.324305 2015] [mpm_winnt:notice] [pid 7044:tid 404] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations
[Tue Jul 14 15:02:13.329306 2015] [mpm_winnt:notice] [pid 7044:tid 404] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Tue Jul 14 15:02:13.329306 2015] [core:notice] [pid 7044:tid 404] AH00094: Command line: 'C:\\Program Files\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/Program Files/wamp/bin/apache/apache2.4.9'
[Tue Jul 14 15:02:13.352308 2015] [mpm_winnt:notice] [pid 7044:tid 404] AH00418: Parent: Created child process 3140
[Tue Jul 14 15:02:14.528388 2015] [mpm_winnt:notice] [pid 3140:tid 332] AH00354: Child: Starting 64 worker threads.
我真的迷路了,我应该在哪里寻找问题? 非常感谢您的帮助
编辑
我意识到存储过程“retrieve_matches”正在根据更改的值调用不同的存储过程。我调试了导致 Apache 崩溃的存储过程“retrieve_standalone”。此过程正在执行选择/插入,我检查并正确插入。 但是在“retrieve_standalone”中,我以一种奇怪的方式使用光标:
declare bNoMoreRows bool default false;
declare tmp_cursor cursor for
select comp_id from to_match; -- to_match is a temporary table
declare continue handler for not found set bNoMoreRows := true;
如果我不打开光标
open tmp_cursor;
一切正常!!所以我想我现在找到了问题:我该如何解决?
【问题讨论】:
-
ERR_CONNECTION_RESET 表示这是浏览器问题,但不是编码问题
-
$stmt->get_result()->fetch_assoc();假定查询返回至少一行。是吗?
-
如果第一个查询有效,怎么可能是浏览器问题?
-
是 $stmt->get_result()->fetch_assoc();返回至少一行,实际上第一个查询是返回第一行的数据
-
ERR_CONNECTION_RESET 是 chrome 问题,与您的代码无关,您可以看到有关该代码的各种答案。我会在那个 stmt->execute 上设置一个真假标志,并确保你正在返回一些东西。
标签: php mysql apache stored-procedures wamp