php / php/php-src

Use of PIDFile= in php-fpm.service

未关闭 适合新手
#21,740 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

When using Type=simple or Type=notify services, the process executed in ExecStart= is monitored directly by systemd and is automatically the main PID. The use of PIDFile= is useless and discouraged by the systemd.service(5) manual page:

Note that PID files should be avoided in modern projects. Use Type=notify, Type=notify-reload or Type=simple where possible, which does not require use of PID files to determine the main process of a service and avoids needless forking.

Source: https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#PIDFile=

Furthermore, the default configuration of php-fpm.conf has pid = commented out, which is equivalent to not having a PID file.

From systemd's point of view, the service remains exactly the same without the PIDFile= directive. I suggest, therefore, that it be dropped.

PHP Version
PHP 8.5.5 (cli) (built: Apr  8 2026 14:36:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.5, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.5, Copyright (c), by Zend Technologies
Operating System

No response

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先定位 php-fpm.service 单元,并结合默认的 php-fpm.conf 读取其中的 PIDFile= 设置;在该文件中,pid = 被注释掉了。查看 issue 中链接的 systemd.service(5) 指南,然后验证移除该指令不会改变服务定义的行为,并且该单元不再包含 PIDFile=。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
devops
Issue 类型
重构
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
基本清楚
新手友好度
65/100

把新 issue 发到你的邮箱

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