From 2d4d85652e0c1af7166e4a53dd19ad5158fbb7a4 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Wed, 17 Oct 2018 15:34:31 +0100
Subject: [PATCH] Prepare for possible later php versions

---
 src/freedombone-app-akaunting        | 10 ++++++----
 src/freedombone-app-bludit           |  7 ++++---
 src/freedombone-app-dokuwiki         |  7 ++++---
 src/freedombone-app-edith            |  4 ++--
 src/freedombone-app-friendica        |  7 ++++---
 src/freedombone-app-gnusocial        | 15 ++++++++-------
 src/freedombone-app-gogs             |  3 ++-
 src/freedombone-app-htmly            |  7 ++++---
 src/freedombone-app-hubzilla         |  7 ++++---
 src/freedombone-app-kanboard         |  7 ++++---
 src/freedombone-app-koel             |  7 ++++---
 src/freedombone-app-lychee           |  7 ++++---
 src/freedombone-app-movim            |  7 ++++---
 src/freedombone-app-nextcloud        | 13 ++++++++-----
 src/freedombone-app-pixelfed         |  7 ++++---
 src/freedombone-app-postactiv        | 16 ++++++++++------
 src/freedombone-app-privatebin       |  7 ++++---
 src/freedombone-app-rss              |  9 +++++----
 src/freedombone-app-searx            |  3 ++-
 src/freedombone-app-smolrss          |  5 +++--
 src/freedombone-logging              |  3 ++-
 src/freedombone-template             |  8 +++++---
 src/freedombone-utils-gnusocialtools |  3 ++-
 src/freedombone-utils-web            |  4 +++-
 src/freedombone-utils-webadmin       | 16 ++++++++--------
 25 files changed, 110 insertions(+), 79 deletions(-)

diff --git a/src/freedombone-app-akaunting b/src/freedombone-app-akaunting
index ab972de81..5cecfb886 100755
--- a/src/freedombone-app-akaunting
+++ b/src/freedombone-app-akaunting
@@ -302,7 +302,8 @@ function install_akaunting {
 
     $INSTALL_PACKAGES php-gettext php-curl php-gd php-mysql git curl
     $INSTALL_PACKAGES memcached php-memcached php-intl exiftool libfcgi0ldbl
-    $INSTALL_PACKAGES php7.0-curl php7.0-gd php7.0-mbstring php7.0-xml php7.0-zip
+    # shellcheck disable=SC2086
+    $INSTALL_PACKAGES php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php${PHP_VERSION}-zip
 
     if [ ! -d "/var/www/$AKAUNTING_DOMAIN_NAME" ]; then
         mkdir "/var/www/$AKAUNTING_DOMAIN_NAME"
@@ -372,7 +373,7 @@ function install_akaunting {
           echo '';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -414,7 +415,7 @@ function install_akaunting {
       echo '';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -445,7 +446,8 @@ function install_akaunting {
     akaunting_remove_bad_links
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a akaunting -p "$AKAUNTING_ADMIN_PASSWORD"
diff --git a/src/freedombone-app-bludit b/src/freedombone-app-bludit
index b741256a9..7cb4e9924 100755
--- a/src/freedombone-app-bludit
+++ b/src/freedombone-app-bludit
@@ -302,7 +302,7 @@ function install_bludit {
           echo '  index index.php;';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -353,7 +353,7 @@ function install_bludit {
       echo '  index index.php;';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -374,7 +374,8 @@ function install_bludit {
 
     nginx_ensite "$BLUDIT_DOMAIN_NAME"
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a bludit -p "$BLUDIT_ADMIN_PASSWORD"
diff --git a/src/freedombone-app-dokuwiki b/src/freedombone-app-dokuwiki
index 58dd5d57a..ed3888d22 100755
--- a/src/freedombone-app-dokuwiki
+++ b/src/freedombone-app-dokuwiki
@@ -374,7 +374,7 @@ function install_dokuwiki {
           echo '        # With php-cgi alone:';
           echo '        # fastcgi_pass 127.0.0.1:9000;';
           echo '        # With php-fpm:';
-          echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '        fastcgi_read_timeout 30;';
           echo '        include fastcgi_params;';
           echo '        fastcgi_index index.php;';
@@ -453,7 +453,7 @@ function install_dokuwiki {
       echo '        # With php-cgi alone:';
       echo '        # fastcgi_pass 127.0.0.1:9000;';
       echo '        # With php-fpm:';
-      echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '        fastcgi_read_timeout 30;';
       echo '        include fastcgi_params;';
       echo '        fastcgi_index index.php;';
@@ -485,7 +485,8 @@ function install_dokuwiki {
 
     nginx_ensite "$DOKUWIKI_DOMAIN_NAME"
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     function_check add_ddns_domain
diff --git a/src/freedombone-app-edith b/src/freedombone-app-edith
index b4220f35d..43a3ed4db 100755
--- a/src/freedombone-app-edith
+++ b/src/freedombone-app-edith
@@ -358,7 +358,7 @@ function install_edith {
           echo '  # PHP';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -395,7 +395,7 @@ function install_edith {
       echo '  # PHP';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
diff --git a/src/freedombone-app-friendica b/src/freedombone-app-friendica
index e0be68bc1..6d066e7e9 100755
--- a/src/freedombone-app-friendica
+++ b/src/freedombone-app-friendica
@@ -428,7 +428,7 @@ function install_friendica {
           echo '        # With php-cgi alone:';
           echo '        # fastcgi_pass 127.0.0.1:9000;';
           echo '        # With php-fpm:';
-          echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '        include fastcgi_params;';
           echo '        fastcgi_read_timeout 30;';
           echo '        fastcgi_index index.php;';
@@ -496,7 +496,7 @@ function install_friendica {
           echo '        # With php-cgi alone:';
           echo '        # fastcgi_pass 127.0.0.1:9000;';
           echo '        # With php-fpm:';
-          echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '        include fastcgi_params;';
           echo '        fastcgi_read_timeout 30;';
           echo '        fastcgi_index index.php;';
@@ -590,7 +590,8 @@ function install_friendica {
     chmod 755 "$FRIENDICA_PATH/.htconfig.php"
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    #shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
     systemctl restart cron
 
diff --git a/src/freedombone-app-gnusocial b/src/freedombone-app-gnusocial
index f1ca6b1a6..e72c9aa6b 100755
--- a/src/freedombone-app-gnusocial
+++ b/src/freedombone-app-gnusocial
@@ -521,8 +521,8 @@ function remove_gnusocial {
     if grep -q 'gnusocial-firewall' /etc/crontab; then
         sed -i '/gnusocial-firewall/d' /etc/crontab
     fi
-    sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' /etc/php/7.0/cli/php.ini
-    sed -i 's|mysqli.reconnect.*|mysqli.reconnect = Off|g' /etc/php/7.0/cli/php.ini
+    sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' "/etc/php/${PHP_VERSION}/cli/php.ini"
+    sed -i 's|mysqli.reconnect.*|mysqli.reconnect = Off|g' "/etc/php/${PHP_VERSION}/cli/php.ini"
 
     if [ -f /usr/bin/gnusocial-firewall ]; then
         rm /usr/bin/gnusocial-firewall
@@ -650,7 +650,7 @@ function install_gnusocial_main {
           echo '    client_max_body_size 50m;';
           echo '    client_body_buffer_size 50m;';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -702,7 +702,7 @@ function install_gnusocial_main {
       echo '    client_max_body_size 50m;';
       echo '    client_body_buffer_size 50m;';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -818,11 +818,12 @@ function install_gnusocial_main {
     fi
 
     # php configuration
-    sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' /etc/php/7.0/cli/php.ini
-    sed -i 's|mysqli.reconnect.*|mysqli.reconnect = On|g' /etc/php/7.0/cli/php.ini
+    sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' "/etc/php/${PHP_VERSION}/cli/php.ini"
+    sed -i 's|mysqli.reconnect.*|mysqli.reconnect = On|g' "/etc/php/${PHP_VERSION}/cli/php.ini"
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-addemail" -u "$MY_USERNAME" -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
diff --git a/src/freedombone-app-gogs b/src/freedombone-app-gogs
index e223837b1..5e7bd322d 100755
--- a/src/freedombone-app-gogs
+++ b/src/freedombone-app-gogs
@@ -614,7 +614,8 @@ function install_gogs {
     GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname)
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     set_completion_param "gogs domain" "$GOGS_DOMAIN_NAME"
diff --git a/src/freedombone-app-htmly b/src/freedombone-app-htmly
index bbd3c2eb7..ba91aea38 100755
--- a/src/freedombone-app-htmly
+++ b/src/freedombone-app-htmly
@@ -435,7 +435,7 @@ function install_htmly_website {
       echo '        # With php-cgi alone:';
       echo '        # fastcgi_pass 127.0.0.1:9000;';
       echo '        # With php-fpm:';
-      echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '        include fastcgi_params;';
       echo '        fastcgi_read_timeout 30;';
       echo '        fastcgi_index index.php;';
@@ -520,7 +520,7 @@ function install_htmly_website_onion {
       echo '        # With php-cgi alone:';
       echo '        # fastcgi_pass 127.0.0.1:9000;';
       echo '        # With php-fpm:';
-      echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '        include fastcgi_params;';
       echo '        fastcgi_read_timeout 30;';
       echo '        fastcgi_index index.php;';
@@ -612,7 +612,8 @@ function install_htmly {
     function_check nginx_ensite
     nginx_ensite "$HTMLY_DOMAIN_NAME"
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a htmly -p "$HTMLY_ADMIN_PASSWORD"
diff --git a/src/freedombone-app-hubzilla b/src/freedombone-app-hubzilla
index 561bb6407..ff6674f04 100755
--- a/src/freedombone-app-hubzilla
+++ b/src/freedombone-app-hubzilla
@@ -441,7 +441,7 @@ function install_hubzilla {
           echo '        # With php-cgi alone:';
           echo '        # fastcgi_pass 127.0.0.1:9000;';
           echo '        # With php-fpm:';
-          echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '        include fastcgi_params;';
           echo '        fastcgi_index index.php;';
           echo "        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;";
@@ -508,7 +508,7 @@ function install_hubzilla {
           echo '        # With php-cgi alone:';
           echo '        # fastcgi_pass 127.0.0.1:9000;';
           echo '        # With php-fpm:';
-          echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '        include fastcgi_params;';
           echo '        fastcgi_index index.php;';
           echo "        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;";
@@ -596,7 +596,8 @@ function install_hubzilla {
     chmod 755 "$HUBZILLA_PATH/.htconfig.php"
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
     systemctl restart cron
 
diff --git a/src/freedombone-app-kanboard b/src/freedombone-app-kanboard
index e0d5628f2..0cb7e905d 100755
--- a/src/freedombone-app-kanboard
+++ b/src/freedombone-app-kanboard
@@ -416,7 +416,7 @@ function install_kanboard {
           echo '  # PHP';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -478,7 +478,7 @@ function install_kanboard {
       echo '  # PHP';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -553,7 +553,8 @@ function install_kanboard {
     chown -R www-data:www-data "/var/www/${KANBOARD_DOMAIN_NAME}/htdocs"
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a kanboard -p "$KANBOARD_ADMIN_PASSWORD"
diff --git a/src/freedombone-app-koel b/src/freedombone-app-koel
index 281e461ba..d7a0ed458 100755
--- a/src/freedombone-app-koel
+++ b/src/freedombone-app-koel
@@ -598,7 +598,7 @@ function install_koel_main {
           echo '  # PHP';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -666,7 +666,7 @@ function install_koel_main {
       echo '  # PHP';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -710,7 +710,8 @@ function install_koel_main {
     nginx_ensite "$KOEL_DOMAIN_NAME"
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a koel -p "$KOEL_ADMIN_PASSWORD"
diff --git a/src/freedombone-app-lychee b/src/freedombone-app-lychee
index 6331cfd4b..6e142a7b6 100755
--- a/src/freedombone-app-lychee
+++ b/src/freedombone-app-lychee
@@ -264,7 +264,7 @@ function install_lychee_website {
       echo '        # With php-cgi alone:';
       echo '        # fastcgi_pass 127.0.0.1:9000;';
       echo '        # With php-fpm:';
-      echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '        include fastcgi_params;';
       echo '        fastcgi_read_timeout 30;';
       echo '        fastcgi_index index.html;';
@@ -333,7 +333,7 @@ function install_lychee_website_onion {
       echo '        # With php-cgi alone:';
       echo '        # fastcgi_pass 127.0.0.1:9000;';
       echo '        # With php-fpm:';
-      echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "        fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '        include fastcgi_params;';
       echo '        fastcgi_read_timeout 30;';
       echo '        fastcgi_index index.html;';
@@ -453,7 +453,8 @@ function install_lychee {
     lychee_create_config
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a lychee -p "$LYCHEE_ADMIN_PASSWORD"
diff --git a/src/freedombone-app-movim b/src/freedombone-app-movim
index dfaec6b8a..66dd40662 100755
--- a/src/freedombone-app-movim
+++ b/src/freedombone-app-movim
@@ -423,7 +423,7 @@ function install_movim {
           echo '  # PHP';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -484,7 +484,7 @@ function install_movim {
       echo '  # PHP';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -542,7 +542,8 @@ function install_movim {
 
     systemctl restart mariadb
     systemctl start movim
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
     APP_INSTALLED=1
 }
diff --git a/src/freedombone-app-nextcloud b/src/freedombone-app-nextcloud
index 64ae2bdcb..83bf9a427 100755
--- a/src/freedombone-app-nextcloud
+++ b/src/freedombone-app-nextcloud
@@ -219,7 +219,8 @@ function nextcloud_update_files {
 function upgrade_nextcloud_base {
     sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/fpm/php.ini
     sed -i "s/memory_limit =.*/memory_limit = ${MAX_PHP_MEMORY}M/g" /etc/php/7.0/cli/php.ini
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
 
     chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
     chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/data
@@ -370,7 +371,8 @@ function remove_nextcloud {
     function_check remove_ddns_domain
     remove_ddns_domain "$NEXTCLOUD_DOMAIN_NAME"
     systemctl restart nginx
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
 }
 
 function install_nextcloud_main {
@@ -488,7 +490,7 @@ function install_nextcloud_main {
           echo '  # PHP';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -551,7 +553,7 @@ function install_nextcloud_main {
       echo '  # PHP';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -615,7 +617,8 @@ function install_nextcloud_main {
 
     NEXTCLOUD_ONION_HOSTNAME=$(add_onion_service nextcloud 80 ${NEXTCLOUD_ONION_PORT})
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-addemail" -u "$MY_USERNAME" -e "noreply@$NEXTCLOUD_DOMAIN_NAME" -g nextcloud --public no
diff --git a/src/freedombone-app-pixelfed b/src/freedombone-app-pixelfed
index d9888170f..ba866facf 100755
--- a/src/freedombone-app-pixelfed
+++ b/src/freedombone-app-pixelfed
@@ -322,7 +322,7 @@ function install_pixelfed {
           echo '  index index.php;';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '    fastcgi_param HTTPS on;';
           echo '  }';
@@ -353,7 +353,7 @@ function install_pixelfed {
       echo '  index index.php;';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '    fastcgi_param HTTPS off;';
       echo '  }';
@@ -403,7 +403,8 @@ function install_pixelfed {
 
     systemctl restart mariadb
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
 
     systemctl restart nginx
 
diff --git a/src/freedombone-app-postactiv b/src/freedombone-app-postactiv
index a940d2a8d..1dbd01eb3 100755
--- a/src/freedombone-app-postactiv
+++ b/src/freedombone-app-postactiv
@@ -575,9 +575,12 @@ function install_postactiv_main {
 
     $INSTALL_PACKAGES php-gettext php-curl php-gd php-mysql git curl
     $INSTALL_PACKAGES memcached php-memcached php-intl exiftool libfcgi0ldbl
-    $INSTALL_PACKAGES php7.0-bcmath php7.0-curl php7.0-exif php7.0-gd
-    $INSTALL_PACKAGES php7.0-intl php7.0-mbstring php7.0-mysqlnd
-    $INSTALL_PACKAGES php7.0-opcache php7.0-readline php7.0-xmlwriter
+    # shellcheck disable=SC2086
+    $INSTALL_PACKAGES php${PHP_VERSION}-bcmath php${PHP_VERSION}-curl php${PHP_VERSION}-exif php${PHP_VERSION}-gd
+    # shellcheck disable=SC2086
+    $INSTALL_PACKAGES php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-mysqlnd
+    # shellcheck disable=SC2086
+    $INSTALL_PACKAGES php${PHP_VERSION}-opcache php${PHP_VERSION}-readline php${PHP_VERSION}-xmlwriter
 
     if [ ! -d "/var/www/$POSTACTIV_DOMAIN_NAME" ]; then
         mkdir "/var/www/$POSTACTIV_DOMAIN_NAME"
@@ -666,7 +669,7 @@ function install_postactiv_main {
           echo '    client_max_body_size 50m;';
           echo '    client_body_buffer_size 50m;';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -718,7 +721,7 @@ function install_postactiv_main {
       echo '    client_max_body_size 50m;';
       echo '    client_body_buffer_size 50m;';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -836,7 +839,8 @@ function install_postactiv_main {
     sed -i 's|mysqli.reconnect.*|mysqli.reconnect = On|g' /etc/php/7.0/cli/php.ini
 
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     "${PROJECT_NAME}-addemail" -u "$MY_USERNAME" -e "noreply@$POSTACTIV_DOMAIN_NAME" -g postactiv --public no
diff --git a/src/freedombone-app-privatebin b/src/freedombone-app-privatebin
index d2d937227..10f547f0b 100755
--- a/src/freedombone-app-privatebin
+++ b/src/freedombone-app-privatebin
@@ -336,7 +336,7 @@ function install_privatebin {
           echo '';
           echo '  location ~ \.php {';
           echo '    include snippets/fastcgi-php.conf;';
-          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+          echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
           echo '    fastcgi_read_timeout 30;';
           echo '  }';
           echo '';
@@ -377,7 +377,7 @@ function install_privatebin {
       echo '';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -421,7 +421,8 @@ function install_privatebin {
 
     secure_privatebin
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     set_completion_param "privatebin domain" "$PRIVATEBIN_DOMAIN_NAME"
diff --git a/src/freedombone-app-rss b/src/freedombone-app-rss
index 8818dee7e..723521ea8 100755
--- a/src/freedombone-app-rss
+++ b/src/freedombone-app-rss
@@ -341,7 +341,7 @@ function install_rss_main {
       echo '';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -385,7 +385,7 @@ function install_rss_main {
       echo '';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '  }';
       echo '';
@@ -407,7 +407,7 @@ function install_rss_main {
       echo '';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '  }';
       echo '';
       echo '  location / {';
@@ -498,7 +498,8 @@ function install_rss_main {
 
     nginx_ensite $RSS_READER_DOMAIN_NAME
     systemctl restart mariadb
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     # daemon to update feeds
diff --git a/src/freedombone-app-searx b/src/freedombone-app-searx
index 73d4db221..debde5d42 100755
--- a/src/freedombone-app-searx
+++ b/src/freedombone-app-searx
@@ -1001,7 +1001,8 @@ function install_searx {
     nginx_ensite searx
 
     # restart the web server
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
     systemctl restart nginx
 
     # start the daemon
diff --git a/src/freedombone-app-smolrss b/src/freedombone-app-smolrss
index f6a728195..4afa0d83f 100755
--- a/src/freedombone-app-smolrss
+++ b/src/freedombone-app-smolrss
@@ -364,7 +364,7 @@ function install_smolrss {
       echo '  index index.php;';
       echo '  location ~ \.php {';
       echo '    include snippets/fastcgi-php.conf;';
-      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '    fastcgi_read_timeout 30;';
       echo '    fastcgi_param HTTPS off;';
       echo '  }';
@@ -380,7 +380,8 @@ function install_smolrss {
 
     nginx_ensite "$SMOLRSS_DOMAIN_NAME"
 
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
 
     systemctl restart nginx
 
diff --git a/src/freedombone-logging b/src/freedombone-logging
index 7856b27b6..86999aa40 100755
--- a/src/freedombone-logging
+++ b/src/freedombone-logging
@@ -293,7 +293,8 @@ fi
 
 fuser -k 80/tcp
 fuser -k 443/tcp
-systemctl restart php7.0-fpm
+# shellcheck disable=SC2086
+systemctl restart php${PHP_VERSION}-fpm
 systemctl restart nginx
 
 exit 0
diff --git a/src/freedombone-template b/src/freedombone-template
index b26053f1b..50bc02c51 100755
--- a/src/freedombone-template
+++ b/src/freedombone-template
@@ -28,6 +28,8 @@
 
 PROJECT_NAME='freedombone'
 
+PHP_VERSION='7.0'
+
 app_name='noapp'
 app_name_lower=$(echo "${app_name}" | tr '[:upper:]' '[:lower:]')
 app_name=$app_name_lower
@@ -779,7 +781,7 @@ if [ $app_webui ]; then
             echo "          echo '  index index.php;';"
             echo "          echo '  location ~ \\.php {';"
             echo "          echo '    include snippets/fastcgi-php.conf;';"
-            echo "          echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';"
+            echo "          echo '    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;';"
             echo "          echo '    fastcgi_read_timeout 30;';"
             echo "          echo '    fastcgi_param HTTPS on;';"
             echo "          echo '  }';"
@@ -824,7 +826,7 @@ if [ $app_webui ]; then
         echo "      echo '  index index.php;';"
         echo "      echo '  location ~ \\.php {';"
         echo "      echo '    include snippets/fastcgi-php.conf;';"
-        echo "      echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';"
+        echo "      echo '    fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;';"
         echo "      echo '    fastcgi_read_timeout 30;';"
         echo "      echo '    fastcgi_param HTTPS off;';"
         echo "      echo '  }';"
@@ -913,7 +915,7 @@ fi
 if [ $app_webui ]; then
     if [[ "$app_php" == 'yes' ]]; then
         echo ''
-        echo '    systemctl restart php7.0-fpm'
+        echo "    systemctl restart php${PHP_VERSION}-fpm"
     fi
     echo ''
     echo '    systemctl restart nginx'
diff --git a/src/freedombone-utils-gnusocialtools b/src/freedombone-utils-gnusocialtools
index 77f12f62f..9589d1e16 100755
--- a/src/freedombone-utils-gnusocialtools
+++ b/src/freedombone-utils-gnusocialtools
@@ -823,7 +823,8 @@ function gnusocial_use_qvitter {
     fuser -k 80/tcp
     fuser -k 443/tcp
     systemctl restart nginx
-    systemctl restart php7.0-fpm
+    # shellcheck disable=SC2086
+    systemctl restart php${PHP_VERSION}-fpm
 }
 
 function gnusocial_use_pleroma {
diff --git a/src/freedombone-utils-web b/src/freedombone-utils-web
index 438569625..9c8dbeca9 100755
--- a/src/freedombone-utils-web
+++ b/src/freedombone-utils-web
@@ -26,6 +26,8 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+PHP_VERSION='7.0'
+
 # default search engine for command line browser
 DEFAULT_SEARCH='https://searx.laquadrature.net'
 
@@ -668,7 +670,7 @@ function image_install_web_server {
     fi
 
     # shellcheck disable=SC2086
-    chroot "$rootdir" $INSTALL_PACKAGES nginx php7.0-fpm
+    chroot "$rootdir" $INSTALL_PACKAGES nginx php${PHP_VERSION}-fpm
 
     if [ ! -d "$rootdir/etc/nginx" ]; then
         echo $'Unable to install web server'
diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin
index 80dd9d4db..bda6a4d20 100755
--- a/src/freedombone-utils-webadmin
+++ b/src/freedombone-utils-webadmin
@@ -937,7 +937,7 @@ function image_install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -949,7 +949,7 @@ function image_install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -1816,7 +1816,7 @@ function install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -1828,7 +1828,7 @@ function install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -1875,7 +1875,7 @@ function install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -1887,7 +1887,7 @@ function install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -1927,7 +1927,7 @@ function install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
@@ -1941,7 +1941,7 @@ function install_web_admin {
       echo "    error_page 405 = \$uri;";
       echo '    location ~ \.php {';
       echo '      include snippets/fastcgi-php.conf;';
-      echo '      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
+      echo "      fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock;";
       echo '      fastcgi_read_timeout 30;';
       echo '    }';
       echo '  }';
-- 
GitLab