Browse Source

add configurable php versions

master
Simon Vieille 1 week ago
parent
commit
87a571034c
Signed by: Simon Vieille <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
2 changed files with 26 additions and 9 deletions
  1. 11
    5
      bin/vhost-add
  2. 15
    4
      etc/config.dist

+ 11
- 5
bin/vhost-add View File

@@ -49,11 +49,17 @@ DOCUMENT_ROOT="$WEB_ROOT_PATH/$DOMAIN/$DOCUMENT_ROOT"
49 49
 PHP_ENABLED="$(form_yes_no -t "$TITLE" -l "Support of PHP")"
50 50
 
51 51
 if [ "$PHP_ENABLED" = "yes" ]; then
52
-	PHP_VERSION="$(form_choices -t "$TITLE" -l "Version of PHP" \
53
-		"7.3" "PHP 7.3 (recommended)" \
54
-		"7.2" "PHP 7.2" \
55
-		"7.1" "PHP 7.1" \
56
-		"5.6" "PHP 5.6 (not recommended)")"
52
+	COMMAND="form_choices -t \"$TITLE\" -l \"Version of PHP\""
53
+
54
+	for PHP_VERSION in $PHP_VERSIONS; do
55
+		PHP_VERSION_NORMALISED="$(echo "$PHP_VERSION" | tr -dc 1234567890)"
56
+
57
+		eval "PHP_LABEL=\$PHP_${PHP_VERSION_NORMALISED}_LABEL"
58
+
59
+		COMMAND="$COMMAND \"$PHP_VERSION\" \"$PHP_LABEL\""
60
+	done
61
+
62
+	PHP_VERSION="$(eval "$COMMAND")"
57 63
 
58 64
 	exit_if_empty "$PHP_VERSION" "Aborded! (PHP_VERSION_EMPTY)"
59 65
 fi

+ 15
- 4
etc/config.dist View File

@@ -1,11 +1,21 @@
1 1
 WEB_HTTP_PORT=81
2 2
 WEB_HTTPS_PORT=444
3
+WEB_HTTPS_DEFAULT_CERT_PEM=/etc/letsencrypt/live/example.com/cert.pem
4
+WEB_HTTPS_DEFAULT_CERT_PRIVKEY=/etc/letsencrypt/live/example.com/privkey.pem
5
+WEB_HTTPS_DEFAULT_CERT_CHAIN=/etc/letsencrypt/live/example.com/chain.pem
6
+
3 7
 SKEL_PATH=/etc/skel
8
+
4 9
 DEFAULT_SHELL=/bin/zsh
10
+
5 11
 WEB_ROOT_PATH=/var/www/service-web/www
6 12
 WEB_LOG_PATH=/services/web/logs
13
+
7 14
 APACHE_VHOST_SITES_AVAILABLE_PATH=/etc/apache2/sites-available
8 15
 APACHE_VHOST_SITES_ENABLED_PATH=/etc/apache2/sites-enabled
16
+
17
+PHP_BIN=/usr/bin/php7.3
18
+PHP_VERSIONS="7.3 7.2 7.1 5.6"
9 19
 PHP_FPM56_POOL_PATH=/etc/php5/fpm/pool.d
10 20
 PHP_FPM71_POOL_PATH=/etc/php/7.1/fpm/pool.d
11 21
 PHP_FPM72_POOL_PATH=/etc/php/7.2/fpm/pool.d
@@ -14,8 +24,9 @@ PHP_FPM56_SERVICE=php5-fpm
14 24
 PHP_FPM71_SERVICE=php7.1-fpm
15 25
 PHP_FPM72_SERVICE=php7.2-fpm
16 26
 PHP_FPM73_SERVICE=php7.3-fpm
17
-PHP_BIN=/usr/bin/php7.3
18
-WEB_HTTPS_DEFAULT_CERT_PEM=/etc/letsencrypt/live/example.com/cert.pem
19
-WEB_HTTPS_DEFAULT_CERT_PRIVKEY=/etc/letsencrypt/live/example.com/privkey.pem
20
-WEB_HTTPS_DEFAULT_CERT_CHAIN=/etc/letsencrypt/live/example.com/chain.pem
27
+PHP_56_LABEL="PHP 5.6 (not recommended)"
28
+PHP_71_LABEL="PHP 7.1"
29
+PHP_72_LABEL="PHP 7.2"
30
+PHP_73_LABEL="PHP 7.3 (recommended)"
31
+
21 32
 SYSTEM_USER_GROUP=webgroup

Loading…
Cancel
Save