Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
php-fpm.service: set KillMode=mixed
Currently, php-fpm.service relies on the default KillMode=control-group, which sends SIGTERM to all
processes in the cgroup simultaneously. This can interfere with php-fpm's internal process management,
where the master process is designed to handle the graceful termination of its child workers.

Setting KillMode=mixed ensures that SIGTERM is sent only to the master process, allowing it to orchestrate
a clean shutdown. If the master process fails to exit within TimeoutStopSec, systemd will send SIGKILL to
all processes in the cgroup. Additionally, if the master exits but leaves orphaned children, systemd will
clean them up via SIGKILL. This mode has been supported since systemd 209 and provides a more robust
shutdown sequence for master-worker architectures.

Closes #18655
  • Loading branch information
marcosfrm committed Apr 13, 2026
commit 837c9014b1c880338ffa1ae8d1d66674887df277
1 change: 1 addition & 0 deletions sapi/fpm/php-fpm.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ After=network.target
Type=@php_fpm_systemd@
ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed

# Set up a new file system namespace and mounts private /tmp and /var/tmp directories
# so this service cannot access the global directories and other processes cannot
Expand Down
Loading