laravel/lumen调用存储过程出现Packets out of order的解决办法

laravel/lumen调用mysql存储过程出现错误提示:Packets out of order. Expected 1 received 4. Packet size=10,并且重复执行了1次,即执行了2次存储过程,解决办法如下:

修改database.php,lumen在vendor/laravel/lumen-framework/config目录下,修改mysql配置为:

‘mysql’ => [
‘driver’ => ‘mysql’,
‘host’ => env(‘DB_HOST’, ‘127.0.0.1’),
‘port’ => env(‘DB_PORT’, 3306),
‘database’ => env(‘DB_DATABASE’, ‘forge’),
‘username’ => env(‘DB_USERNAME’, ‘forge’),
‘password’ => env(‘DB_PASSWORD’, ”),
‘unix_socket’ => env(‘DB_SOCKET’, ”),
‘charset’ => env(‘DB_CHARSET’, ‘utf8mb4’),
‘collation’ => env(‘DB_COLLATION’, ‘utf8mb4_unicode_ci’),
‘prefix’ => env(‘DB_PREFIX’, ”),
‘strict’ => env(‘DB_STRICT_MODE’, true),
‘engine’ => env(‘DB_ENGINE’, null),
‘timezone’ => env(‘DB_TIMEZONE’, ‘+00:00’),
‘options’ => [
PDO::MYSQL_ATTR_INIT_COMMAND => ‘SET NAMES utf8’,
PDO::ATTR_EMULATE_PREPARES => true,
],
],

即增加了’options’ => [
PDO::MYSQL_ATTR_INIT_COMMAND => ‘SET NAMES utf8’,
PDO::ATTR_EMULATE_PREPARES => true,
],

ok搞定,不报错,并且只执行了一次存储过程。