From df414346e939169279c35c090c3352cb508cce39 Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Wed, 8 Apr 2026 17:46:42 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20SystemController=20php-fpm=20detection?= =?UTF-8?q?=20=E2=80=94=20probe=20phpX.Y-fpm=20from=20running=20PHP=20vers?= =?UTF-8?q?ion=20first?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.md | 1 + src/SystemController.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 923ef27..f043ac5 100644 --- a/TODO.md +++ b/TODO.md @@ -2,3 +2,4 @@ ## Fixes - [x] Replace `mb_strlen`/`mb_substr` with `strlen`/`substr` in TfeController, SearchController, Parsedown — mbstring extension not available on production server +- [x] SystemController: PHP-FPM status check — dynamically probe `phpX.Y-fpm` unit derived from running PHP version before static fallback list; add `php8.4-fpm` to cover current production PHP 8.4 diff --git a/src/SystemController.php b/src/SystemController.php index 9540038..7071216 100644 --- a/src/SystemController.php +++ b/src/SystemController.php @@ -290,10 +290,15 @@ class SystemController 'detail' => $nginxVersion, ]; - // php-fpm (try versioned unit names first) - $phpFpmStatus = null; - $phpFpmUnit = null; - foreach (['php8.3-fpm', 'php8.2-fpm', 'php8.1-fpm', 'php-fpm'] as $unit) { + // php-fpm — probe running PHP version's unit first, then fall back + $phpFpmStatus = null; + $phpFpmUnit = null; + $phpMajMin = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION; + $fpmCandidates = array_unique([ + 'php' . $phpMajMin . '-fpm', + 'php8.4-fpm', 'php8.3-fpm', 'php8.2-fpm', 'php8.1-fpm', 'php-fpm', + ]); + foreach ($fpmCandidates as $unit) { $s = $this->systemdStatus($unit); if ($s !== null && $s !== 'unknown') { $phpFpmStatus = $s;