@@ -24,18 +24,17 @@ export EXTENSIONS="gd,bcmath,pdo,mysqli,pdo_mysql,redis,bz2,calendar,opcache,pcn
2424# Param 2: Specific PHP Minor version
2525# Return : 1 if greater than or equal to, 0 if less than
2626#
27- isPhpVersionGreaterOrEqual () {
28- # local PHP_MAJOR_VERSION=$(php -r "echo PHP_MAJOR_VERSION;")
29- # local PHP_MINOR_VERSION=$(php -r "echo PHP_MINOR_VERSION;")
30-
31- # if [[ "$PHP_MAJOR_VERSION" -gt "$1" || "$PHP_MAJOR_VERSION" -eq "$1" && "$PHP_MINOR_VERSION" -ge "$2" ]]; then
32- # return 1;
33- # else
34- # return 0;
35- # fi
36- return 0
37- }
27+ isPhpVersionGreaterOrEqual ()
28+ {
29+ local PHP_MAJOR_VERSION=$( php -r " echo PHP_MAJOR_VERSION;" )
30+ local PHP_MINOR_VERSION=$( php -r " echo PHP_MINOR_VERSION;" )
3831
32+ if [[ " $PHP_MAJOR_VERSION " -gt " $1 " || " $PHP_MAJOR_VERSION " -eq " $1 " && " $PHP_MINOR_VERSION " -ge " $2 " ]]; then
33+ return 1;
34+ else
35+ return 0;
36+ fi
37+ }
3938#
4039# Install extension from package file(.tgz),
4140# For example:
187186
188187if [[ -z " ${EXTENSIONS##* ,gd,* } " ]]; then
189188 echo " ---------- Install gd ----------"
190- options=" --with-freetype --with-jpeg --with-webp"
189+ isPhpVersionGreaterOrEqual 8 0
190+
191+ if [[ " $? " = " 1" ]]; then
192+ options=" --with-freetype --with-jpeg --with-webp"
193+ else
194+ options=" --with-gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/"
195+ fi
191196
192197 apk add --no-cache \
193198 freetype \
@@ -196,13 +201,13 @@ if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
196201 libpng-dev \
197202 libjpeg-turbo \
198203 libjpeg-turbo-dev \
199- libwebp-dev &&
200- docker-php-ext-configure gd ${options} &&
201- docker-php-ext-install ${MC} gd &&
202- apk del \
203- freetype-dev \
204- libpng-dev \
205- libjpeg-turbo-dev
204+ libwebp-dev \
205+ && docker-php-ext-configure gd ${options} \
206+ && docker-php-ext-install ${MC} gd \
207+ && apk del \
208+ freetype-dev \
209+ libpng-dev \
210+ libjpeg-turbo-dev
206211fi
207212
208213if [[ -z " ${EXTENSIONS##* ,intl,* } " ]]; then
0 commit comments