mysql - PHP Apache crashes while executing a STORED PROCEDURE -
problem
when execute following code (i'm calling stored procedure 5 in parameters , 1 out parameter)
$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; } { if ($res = $stmt->get_result()) { //apache crash on 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 crashing error:
ah00428: parent: child process 9628 exited status 255 -- restarting.
what tried
- this code working fine , it's returning correctly results:
$conn->query("set @res = ''"); $res=$conn->query("call retrieve_matches(5,3, 16, 2, false, @res)"); var_dump($res->fetch_assoc());
note: same code above make apache crashing working correctly if change number in input of stored procedure like:
if (!($stmt = $mysqli->prepare("call retrieve_matches(5,6, 16, 2, false, @res)"))) {
- tried mysql workbench , both calls working fine.
- i'm using wamp 64b on win7 enterprise 64b, tried wamp 32b got same problem.
- i checked windows event , found httpd.exe crashing caused php5ts.dll
- if search "httpd.exe php5ts.dll" on google can find lot of people incountering problem. didn't find solution wamp...
- tried ampps, exact same problem
php error log
[10-jul-2015 15:30:03 utc] php warning: php startup: unable 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 load dynamic library 'c:/program files/wamp/bin/php/php5.5.12/ext/php_intl.dll' - impossibile trovare il modulo specificato.
apache error log:
[tue jul 14 15:02:13.038276 2015] [mpm_winnt:notice] [pid 7044:tid 404] ah00428: parent: child process 9448 exited 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.
i'm lost here, should issue? help
edit
i realized stored procedure "retrieve_matches" calling different stored procedure in function of changed value. debugged stored procedure "retrieve_standalone" 1 make apache crashing. procedure doing select/insert, checked , insert made correctly. inside "retrieve_standalone" i'm using cursor in weird way:
declare bnomorerows bool default false; declare tmp_cursor cursor select comp_id to_match; -- to_match temporary table declare continue handler not found set bnomorerows := true;
if don't open cursor
open tmp_cursor;
everything working fine!! guess found issue, now: how can solve it?
apparently there's bit of buck passing - i.e. scaricabarile - between php guys , mysqli guys.
what seems happening mysqli reacts in "improper" way, , return unexpected value (i'd bet small sum on being null) php, duly coredumps. behaviour is documented , verdict phpland is: "not [php] bug". on side, mysqli guys maintain it's php not correctly checking returned result. , 'improper' results depended on your query anyway.
so i'm going out on limb , supposing yours same problem of "communication difficulties", problem becomes: "your query forces mysqli drop/reconnect". why so? apparently (some) stored procedures require mysqli_multi_query
in order behave properly.
and mysqli_multi_query
not compatible mysqli_prepare
.
so i'd suggest trying without preparing query, , running mysqli_multi_query
.
$conn->query("set @res = ''"); $conn->multi_query("call retrieve_matches(5,3, 16, 2, false, @res)"); { if ($result = $conn->store_result()) { while ($row = $result->fetch_row()) { var_dump($row); } $result->free(); } } while ($conn->more_results() && $conn->next_result());
with code, test case gets me, expected,
array(1) { [0] => string(4) "test" }
Comments
Post a Comment