Comments (1)
MySQL server has gone away 一般是由于mysql连接长时间不活跃被mysql服务端关闭。illuminate\database
内部有重连机制,这个warning可以忽略。
如果不想看到这个warning,你可以尝试将mysql服务端wait_timeout
参数加大。
或者使用定时器,定时select数据,防止mysql连接被关闭,像下面这样。
创建文件 support/bootstrap/db/Heartbeat.php
如下:
<?php
namespace support\bootstrap\db;
use Webman\Bootstrap;
use support\Db;
class Heartbeat implements Bootstrap
{
public static function start($worker)
{
\Workerman\Timer::add(30, function (){
Db::select('select 1 limit 1');
});
}
}
在config/bootstrap.php
中加入如下代码。
return [
省略...
support\bootstrap\db\Heartbeat::class,
];
这样webman进程启时就会启动一个定时器,定时与mysql通讯,防止连接不活跃被断开。这里定时间隔时30秒,你可以根据mysql服务端wait_timeout
参数设定的值修改定时间隔。
from webman.
Related Issues (20)
- composer update 会将自己在 helpers.php 里写的函数覆盖没.... HOT 4
- 助手函数helpers.php 中locale方法在设置 $locale时应该是无返回的
- 数据库正确的配置,但是提示用户名密码错误,不应该啊?
- upload in host HOT 3
- workerman v5 要出了吗?同步调用传参很需要呀、 HOT 2
- PHP8 下由于 psr/container 安装数据库扩展失败的问题 HOT 5
- 在日志文件不可写的情况下,会把完整的异常信息发送至客户端 HOT 1
- 为什么我webman写的接收图片接口 接收20M图片要 20秒 我PHP原生写的接收图片只要6秒 HOT 2
- Binary packaging compatibility with ARM HOT 1
- unable to install HOT 1
- How to Configure Session for Multiple Applications? HOT 2
- 建议排除abstract类
- 内存监控任务 在windows下 无法调用posix_getppid 的错误问题 HOT 1
- composer require 报错 HOT 2
- Need Help Getting Browser-Detect or Mobile-Detect to Work with Webman HOT 2
- 多级控制器方法名支持驼峰命名的处理办法,希望下个版本加入 HOT 2
- 变量名称错误导致控制台打印状态报错 HOT 2
- Disable view caching when using blade templates? HOT 1
- 压测在webman中进行 redis get 效果不是很理想, 原因未知.. HOT 4
- 我要集成gRPC服务
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webman.