From e574c6cfe4383e05cb3056501f4edf267d979c47 Mon Sep 17 00:00:00 2001 From: allan Date: Wed, 29 Oct 2025 11:07:41 +0100 Subject: [PATCH] new php-fpm check --- dokuwikiinstall | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dokuwikiinstall b/dokuwikiinstall index c826495..dfe4189 100755 --- a/dokuwikiinstall +++ b/dokuwikiinstall @@ -14,7 +14,12 @@ if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo # Define variables and functions # hostname="$1" -phpver=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') ; phpfpm="php$phpver-fpm" + +# +# Get php-fpm version +# +phpfpm=$(systemctl list-units --type=service --all | awk '/php[0-9]+\.[0-9]+-fpm/ {print $1; exit}' | sed 's/\.service//') +if [[ -z "$phpfpm" ]]; then printf "\nUnable to detect php-fpm version. Is PHP-FPM installed?\n\n" ; exit 1 ; fi # # Function usage @@ -72,13 +77,14 @@ chown -R www-data: "$wikidir" # Create a DokuWiki nginx configuration file # cp "$nginxsnippets/hostfiles/dokuwiki.80.conf" /etc/nginx/conf.d/"$hostname".conf -sed -i "s/DOMAIN/$hostname/g" /etc/nginx/conf.d/"$hostname".conf -sed -i "s/VERSION/$phpver/" /etc/nginx/conf.d/"$hostname".conf +sed -i -- "s/DOMAIN/$hostname/g" /etc/nginx/conf.d/"$hostname".conf +sed -i "s/PHPVERSION/$phpfpm/" /etc/nginx/conf.d/"$hostname".conf # # Restarting Nginx and Phpfpm for changes to take effect # -systemctl restart "$phpfpm" ; systemctl restart nginx +systemctl restart "$phpfpm" +systemctl restart nginx # # Create postinstall script