php / php/php-src

php-fpm process: SQLSTATE[HY000] [2002] Connection timed out with database

未关闭
#14,911 8 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@SakiTakamachi 已经在做这个了。

开始于 2024年7月11日。

Bug Extension: pdo_mysql Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

I have a problem with upgrading a server from Centos to Ubuntu (both use Nginx, php, mysql, laravel application)

OS version:
  • Centos: CentOS Linux release 7.9.2009 (Core)
  • Ubuntu: Ubuntu 22.04.4 LTS
Nginx version:
  • Centos: nginx/1.20.1
  • Ubuntu: nginx/1.18.0 (Ubuntu)
PHP version:
  • Centos: PHP 8.1.29 (cli)
  • Ubuntu: PHP 8.1.29 (cli)
mysql connection is the same for both servers
php-fpm config is the same for both servers, command check php-fpm8.1 -tt
pm = dynamic
pm.max_children = 500
pm.start_servers = 50
pm.min_spare_servers = 50
pm.max_spare_servers = 350
pm.max_spawn_rate = 32
pm.process_idle_timeout = 10
pm.max_requests = 0

When the number of requests is large, the Centos server will operate normally, but the Ubuntu server will have some requests with connection timeout errors as follows:

SQLSTATE[HY000] [2002] Connection timed out {"exception":"[object] (PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection timed out at /vendor/laravel/framework/src/Illuminate/Database /Connectors/Connector.php:70)

Could you please share more knowledge about this issue?

Thank you 🙇

PHP Version

PHP 8.1.29

Operating System

Ubuntu 22.04.4 LTS

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。