沃梦达 / 编程问答 / php问题 / 正文

错误的 COM_STMT_PREPARE 响应大小.收到 7. LARAVEL 错误

Wrong COM_STMT_PREPARE response size. Received 7. LARAVEL ERROR(错误的 COM_STMT_PREPARE 响应大小.收到 7. LARAVEL 错误)

本文介绍了错误的 COM_STMT_PREPARE 响应大小.收到 7. LARAVEL 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 laravel 开发的博客.在我的本地 PC 中,一切正常.但是当我将它上传到实时共享托管服务器时,它会引发如下错误:MySqlConnector.php 第 124 行中的

ErrorException:错误的 COM_STMT_PREPARE 响应大小.收到 7

我的服务器配置如下

<块引用>

  1. 服务器:MariaDB
  2. 服务器版本:10.1.20-MariaDB - MariaDB 服务器
  3. PHP 5.6

我找不到任何解决方案.任何帮助将不胜感激.

解决方案

我也遇到了同样的问题.我的网络托管服务提供商是 000webhost.只需在数据库配置文件 (config/database.php) 中将此 PDO 属性 PDO::ATTR_EMULATE_PREPARES 设置为 true,它应该可以正常工作.

例如:

'mysql' =>['司机' =>'mysql','主机' =>env('DB_HOST', 'localhost'),//.......'选项' =>[PDO::ATTR_EMULATE_PREPARES =>真的,]],

此外,如果您已缓存配置或在生产环境中运行,您可能需要运行 php artisan config:cache.

I have a blog that is developed using laravel. In my local PC, everything is okay. But when I upload it in live shared hosting server it throws error like below:

ErrorException in MySqlConnector.php line 124:
Wrong COM_STMT_PREPARE response size. Received 7

My server configuration is given below

  1. Server: MariaDB
  2. Server version: 10.1.20-MariaDB - MariaDB Server
  3. PHP 5.6

I could not find any solution. Any help would be greatly appreciated.

解决方案

I also faced the same problem. My web host provider was 000webhost. Just set this PDO attribute PDO::ATTR_EMULATE_PREPARES to true in your database config file (config/database.php) and it should work fine.

Eg:

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', 'localhost'),
    //.......
    'options'   => [PDO::ATTR_EMULATE_PREPARES => true,]
],

Additionally, you may need to run php artisan config:cache if you have cached your configuration or if running in production environment.

这篇关于错误的 COM_STMT_PREPARE 响应大小.收到 7. LARAVEL 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:错误的 COM_STMT_PREPARE 响应大小.收到 7. LARAVEL 错误

基础教程推荐