Skip to content
Advertisement

PHP Apache crashes while executing a STORED PROCEDURE

Problem

When I execute the following code (I’m calling a stored procedure with 5 IN parameters and 1 OUT parameter)

JavaScript

apache is crashing with error:

AH00428: Parent: child process 9628 exited with status 255 — Restarting.

What I tried

  1. This code is working fine and it’s returning correctly the results:
JavaScript

NOTE: The same code above that make Apache crashing is working correctly if I just change the number in input of the stored procedure like:

JavaScript
  1. Tried from MySQl workbench and both calls are working fine.
  2. I’m using WAMP 64b on a WIN7 Enterprise 64b, I tried with WAMP 32b but got same problem.
  3. I checked windows event and I found httpd.exe is crashing caused by php5ts.dll
  4. If you search for “httpd.exe php5ts.dll” on google you can find a lot of people incountering this problem. But I didn’t find a solution for WAMP…
  5. Tried with AMPPS, exact same problem

PHP Error Log

JavaScript

APACHE error log:

JavaScript

I’m really lost here, where should I look for the issue? Thanks very much for your help

EDIT

I realized that the stored procedure “retrieve_matches” is calling different stored procedure in function of the changed value. I debugged the stored procedure “retrieve_standalone” that is the one that make Apache crashing. This procedure is doing select/insert, I checked and the insert are made correctly. BUT inside “retrieve_standalone” I’m using a cursor in a weird way:

JavaScript

if I don’t open the cursor

JavaScript

everything is working fine!! So I guess I found the issue, now: how can I solve it?

Advertisement

Answer

Apparently there’s a bit of buck passing – i.e. scaricabarile – between PHP guys and MySQLi guys.

What seems to be happening is that MySQLi reacts in an “improper” way, and return an unexpected value (I’d bet a small sum on it being a NULL) to PHP, which duly coredumps. This behaviour is documented and the verdict from PHPland is: “Not a [PHP] bug”. On their side, the MySQLi guys maintain that it’s PHP which is not correctly checking the returned result. And that ‘improper’ results depended on your query anyway.

So I’m going out on a limb and supposing that yours is the same problem of “communication difficulties”, so the problem becomes: “Your query forces MySQLi to drop/reconnect”. Why is that so? Apparently (some) stored procedures require mysqli_multi_query in order to behave properly.

And mysqli_multi_query is not compatible with mysqli_prepare.

So I’d suggest trying without preparing the query, and running it with mysqli_multi_query.

JavaScript

With this code, your test case gets me, as expected,

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement