From 23190c9a56be2a621cd34774beb45f00faf8b46b Mon Sep 17 00:00:00 2001 From: Wilhansen Li Date: Wed, 17 Apr 2024 00:48:58 +0800 Subject: [PATCH 1/2] Make /ping of php-fpm work again The ping feature of php-fpm monitoring was previously not working due to the configuration variables ping.path and ping.response not being copied over to the worker when forked. This results in the ping code path being disabled because the worker detects that ping.path is not configured. --- sapi/fpm/fpm/fpm_conf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index e1aec90ff3e83..389a85a7d0fc1 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -752,6 +752,8 @@ static int fpm_worker_pool_shared_status_alloc(struct fpm_worker_pool_s *shared_ FPM_WPC_STR_CP(config, shared_config, user); FPM_WPC_STR_CP(config, shared_config, group); FPM_WPC_STR_CP(config, shared_config, pm_status_path); + FPM_WPC_STR_CP(config, shared_config, ping_path); + FPM_WPC_STR_CP(config, shared_config, ping_response); config->pm = PM_STYLE_ONDEMAND; config->pm_max_children = 2; From 6e510b773cfc4767cdf71c872e233c4c553a6055 Mon Sep 17 00:00:00 2001 From: Pierrick Charron Date: Fri, 14 Jun 2024 08:05:38 -0400 Subject: [PATCH 2/2] Add test --- sapi/fpm/tests/status-ping.phpt | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sapi/fpm/tests/status-ping.phpt diff --git a/sapi/fpm/tests/status-ping.phpt b/sapi/fpm/tests/status-ping.phpt new file mode 100644 index 0000000000000..9516efad751ee --- /dev/null +++ b/sapi/fpm/tests/status-ping.phpt @@ -0,0 +1,40 @@ +--TEST-- +FPM: Ping on the status invisible pool +--SKIPIF-- + +--FILE-- +start(); +$tester->expectLogStartNotices(); +$tester->ping('{{ADDR[status]}}'); +usleep(100000); +$tester->terminate(); +$tester->expectLogTerminatingNotices(); +$tester->close(); + +?> +Done +--EXPECT-- +Done +--CLEAN-- +