Support the ongoing development of →
Database Eloquent Queues
Last updated 1 year ago.

OK I found the solution here.

The problem is not related to concurrency.

The issue is that when calling a stored procedure using the PDO if the procedure returns a result set and you do not fetch all the rows in it the next time you use the DB connection this error will be occur.

Closing the statement and calling closeCursor(); is not sufficient

            $stmt = DB::connection()->getPdo()->prepare("CALL credit_account(?)");
            $stmt->bindParam(1, $id);

use the DB connection to do any thing

ERROR Packets out of order. Expected 1 received 16. Packet size=7

the work around is to well always use the result set returned by the prepared call if you need it or not.

Check out 
bugs.mysql . com/bug.php?id=68359


This solution only half fixed the problem and resulted in some some inconsistent behaviour

This fixed it

     $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);


Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?

abelgo abelgo Joined 15 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.