@@ -11,7 +11,7 @@ set -eux
1111# Clean up
1212rm -rf /var/lib/apt/lists/*
1313
14- VERSION =" ${VERSION:- " latest" } "
14+ PHP_VERSION =" ${VERSION:- " latest" } "
1515INSTALL_COMPOSER=" ${INSTALLCOMPOSER:- " true" } "
1616OVERRIDE_DEFAULT_VERSION=" ${OVERRIDEDEFAULTVERSION:- " true" } "
1717
@@ -20,7 +20,7 @@ USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
2020UPDATE_RC=" ${UPDATE_RC:- " true" } "
2121
2222# Comma-separated list of php versions to be installed
23- # alongside VERSION , but not set as default.
23+ # alongside PHP_VERSION , but not set as default.
2424ADDITIONAL_VERSIONS=" ${ADDITIONALVERSIONS:- " " } "
2525
2626export DEBIAN_FRONTEND=noninteractive
@@ -92,7 +92,7 @@ find_version_from_git_tags() {
9292 local last_part=" ${escaped_separator} [0-9]+"
9393 local regex=" \\ K[0-9]+${escaped_separator} [0-9]+${last_part} $"
9494 local version_list=" $( git ls-remote --tags ${repository} | grep -oP " ${regex} " | tr -d ' ' | tr " ${separator} " " ." | sort -rV) "
95- VERSION =" $( echo " ${version_list} " | head -n 1) "
95+ PHP_VERSION =" $( echo " ${version_list} " | head -n 1) "
9696}
9797
9898# Install PHP Composer
@@ -113,7 +113,15 @@ addcomposer() {
113113RUNTIME_DEPS=" wget ca-certificates git build-essential xz-utils"
114114
115115# PHP dependencies
116- PHP_DEPS=" libssl-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev libxml2-dev zlib1g-dev libsodium-dev libargon2-dev libonig-dev"
116+ PHP_DEPS=" libssl-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev libxml2-dev zlib1g-dev libsodium-dev libonig-dev"
117+
118+ . /etc/os-release
119+
120+ if [ " ${VERSION_CODENAME} " = " bionic" ]; then
121+ PHP_DEPS=" ${PHP_DEPS} libargon2-0-dev"
122+ else
123+ PHP_DEPS=" ${PHP_DEPS} libargon2-dev"
124+ fi
117125
118126# Dependencies required for running "phpize"
119127PHPIZE_DEPS=" autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c"
@@ -122,16 +130,16 @@ PHPIZE_DEPS="autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c"
122130check_packages $RUNTIME_DEPS $PHP_DEPS $PHPIZE_DEPS
123131
124132install_php () {
125- VERSION =" $1 "
133+ PHP_VERSION =" $1 "
126134
127135 # Fetch latest version of PHP if needed
128- if [ " ${VERSION } " = " latest" ] || [ " ${VERSION } " = " lts" ]; then
136+ if [ " ${PHP_VERSION } " = " latest" ] || [ " ${PHP_VERSION } " = " lts" ]; then
129137 find_version_from_git_tags
130138 fi
131139
132- PHP_INSTALL_DIR=" ${PHP_DIR} /${VERSION } "
140+ PHP_INSTALL_DIR=" ${PHP_DIR} /${PHP_VERSION } "
133141 if [ -d " ${PHP_INSTALL_DIR} " ]; then
134- echo " (!) PHP version ${VERSION } already exists."
142+ echo " (!) PHP version ${PHP_VERSION } already exists."
135143 exit 1
136144 fi
137145
@@ -140,7 +148,7 @@ install_php() {
140148 fi
141149 usermod -a -G php " ${USERNAME} "
142150
143- PHP_URL=" https://www.php.net/distributions/php-${VERSION } .tar.gz"
151+ PHP_URL=" https://www.php.net/distributions/php-${PHP_VERSION } .tar.gz"
144152
145153 PHP_INI_DIR=" ${PHP_INSTALL_DIR} /ini"
146154 CONF_DIR=" ${PHP_INI_DIR} /conf.d"
@@ -160,7 +168,7 @@ install_php() {
160168 # PHP 7.4+, the pecl/pear installers are officially deprecated and are removed in PHP 8+
161169 # Thus, requiring an explicit "--with-pear"
162170 IFS=" ."
163- read -a versions <<< " ${VERSION }"
171+ read -a versions <<< " ${PHP_VERSION }"
164172 PHP_MAJOR_VERSION=${versions[0]}
165173 PHP_MINOR_VERSION=${versions[1]}
166174
@@ -210,7 +218,7 @@ install_php() {
210218 updaterc " if [[ \"\$ {PATH}\" != *\" ${CURRENT_DIR} \" * ]]; then export PATH=\" ${CURRENT_DIR} /bin:\$ {PATH}\" ; fi"
211219}
212220
213- install_php " ${VERSION } "
221+ install_php " ${PHP_VERSION } "
214222
215223# Additional php versions to be installed but not be set as default.
216224if [ ! -z " ${ADDITIONAL_VERSIONS} " ]; then
0 commit comments