首页 > 解决方案 > SQLSTATE[HY000]:一般错误:1436 共享主机上的线程堆栈溢出

问题描述

嗨,我正在使用这个 Laravel 包https://github.com/nicolaslopezj/searchable

这是我的代码:

$RelatedProducts = Product::where('product_status', 1)
            ->search($product->product_name)
            ->with('images')
            ->take(10)->get();

它在我的本地机器 (XAMPP-Windows) 上运行良好,但在我的 Linux 共享主机上运行良好

当我正在寻找大的东西时,它会返回此错误:

我想我必须更改 SQL 配置文件,但是在共享主机上他们不允许这样做,有没有其他方法可以做到这一点?

SQLSTATE[HY000]: General error: 1436 Thread stack overrun: 230160 bytes used of a 262144 byte stack, and 32000 bytes needed.

标签: mysqllinuxlaravel

解决方案


解决方案

您应该将 thread_stuck 提高到 512k,这通常足以永久避免此问题。

  1. 备份并编辑my.cnf,找到thread_stack指令并修改为512k

  2. 重启 MySQL 服务以重新加载新配置

  3. 运行您的 PHP 脚本或再次测试


推荐阅读