From b07fc2061ae7826a9dc8061d5a81c0f210803adf Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 30 Nov 2020 23:20:45 +0100 Subject: [PATCH] Do not reload php-fpm if conf breaks it (#1087) --- data/helpers.d/php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/data/helpers.d/php b/data/helpers.d/php index 5df31f32b..95cc15402 100644 --- a/data/helpers.d/php +++ b/data/helpers.d/php @@ -256,7 +256,13 @@ WantedBy=multi-user.target # Restart the service, as this service is either stopped or only for this app ynh_systemd_action --service_name=$fpm_service --action=restart else - # Reload PHP, to not impact other parts of the system using PHP + # Validate that the new php conf doesn't break php-fpm entirely + php-fpm${phpversion} --test 2>/dev/null \ + && ynh_systemd_action --service_name=$fpm_service --action=reload \ + || { php-fpm${phpversion} --test || true; + ynh_secure_remove --file="$finalphpconf"; + ynh_die --message="The new configuration broke php-fpm?" + } ynh_systemd_action --service_name=$fpm_service --action=reload fi }