fix: 解决 PHP 安装 ioncube_loader 失败的问题 (#137)

This commit is contained in:
zhengkunwang223 2023-06-05 15:04:27 +08:00 committed by GitHub
parent 581c743569
commit 7490d78a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 449 additions and 597 deletions

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -209,6 +209,11 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 7 4

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -209,6 +209,11 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 7 4

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -209,6 +209,11 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 7 4

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -27,9 +27,9 @@ export EXTENSIONS=",${PHP_EXTENSIONS},"
# specific version. # specific version.
# #
# For example, to check if current php is greater than or # For example, to check if current php is greater than or
# equal to PHP 7.0: # equal to PHP 8.0:
# #
# isPhpVersionGreaterOrEqual 7 0 # isPhpVersionGreaterOrEqual 8 0
# #
# Param 1: Specific PHP Major version # Param 1: Specific PHP Major version
# Param 2: Specific PHP Minor version # Param 2: Specific PHP Minor version
@ -62,7 +62,6 @@ installExtensionFromTgz()
tgzName=$1 tgzName=$1
para1= para1=
extensionName="${tgzName%%-*}" extensionName="${tgzName%%-*}"
if [ $2 ]; then if [ $2 ]; then
para1=$2 para1=$2
fi fi
@ -209,9 +208,14 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
# "--with-xxx-dir" was removed from php 7.4, # "--with-xxx-dir" was removed from php 7.4,
@ -380,47 +384,47 @@ fi
if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install ssh2 ----------" echo "---------- Install ssh2 ----------"
printf "\n" | apk add libssh2-dev printf "\n" | apk add libssh2-dev
pecl install ssh2-1.1.2 pecl install ssh2-1.1.2
docker-php-ext-enable ssh2 docker-php-ext-enable ssh2
else else
echo "ssh2 requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "ssh2 requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install protobuf ----------" echo "---------- Install protobuf ----------"
printf "\n" | pecl install protobuf printf "\n" | pecl install protobuf
docker-php-ext-enable protobuf docker-php-ext-enable protobuf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yac ----------" echo "---------- Install yac ----------"
printf "\n" | pecl install yac-2.0.2 printf "\n" | pecl install yac-2.0.2
docker-php-ext-enable yac docker-php-ext-enable yac
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yar ----------" echo "---------- Install yar ----------"
printf "\n" | pecl install yar printf "\n" | pecl install yar
docker-php-ext-enable yar docker-php-ext-enable yar
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -428,13 +432,13 @@ fi
if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yaconf ----------" echo "---------- Install yaconf ----------"
printf "\n" | pecl install yaconf printf "\n" | pecl install yaconf
docker-php-ext-enable yaconf docker-php-ext-enable yaconf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -452,7 +456,7 @@ if [[ -z "${EXTENSIONS##*,varnish,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install pdo_sqlsrv ----------" echo "---------- Install pdo_sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
@ -461,24 +465,24 @@ if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk
apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install sqlsrv ----------" echo "---------- Install sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
printf "\n" | pecl install sqlsrv printf "\n" | pecl install sqlsrv
docker-php-ext-enable sqlsrv docker-php-ext-enable sqlsrv
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install mcrypt ----------" echo "---------- Install mcrypt ----------"
apk add --no-cache libmcrypt-dev libmcrypt re2c apk add --no-cache libmcrypt-dev libmcrypt re2c
@ -492,10 +496,10 @@ if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- mysql was REMOVED from PHP 7.0.0 ----------" echo "---------- mysql was REMOVED from PHP 8.0.0 ----------"
else else
echo "---------- Install mysql ----------" echo "---------- Install mysql ----------"
docker-php-ext-install ${MC} mysql docker-php-ext-install ${MC} mysql
@ -503,10 +507,10 @@ if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo echo
echo "Sodium is bundled with PHP from PHP 7.2.0" echo "Sodium is bundled with PHP from PHP 8.0.0"
echo echo
else else
echo "---------- Install sodium ----------" echo "---------- Install sodium ----------"
@ -517,64 +521,46 @@ fi
if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then
echo "---------- Install amqp ----------" echo "---------- Install amqp ----------"
apk add --no-cache rabbitmq-c-dev apk add --no-cache -U autoconf
installExtensionFromTgz amqp-1.10.2 apk add --no-cache -U gcc
apk add --no-cache -U linux-headers
apk add --no-cache -U libc-dev
apk add --no-cache --update --virtual .phpize-deps-configure $PHPIZE_DEPS \
&& apk add rabbitmq-c-dev \
&& printf '\n' | pecl install amqp \
&& docker-php-ext-enable amqp \
&& apk del .phpize-deps-configure
fi fi
if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then
echo "---------- Install redis ----------" echo "---------- Install redis ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz redis-5.3.7
if [[ "$?" = "1" ]]; then
installExtensionFromTgz redis-5.2.2
else
printf "\n" | pecl install redis-4.3.0
docker-php-ext-enable redis
fi
fi fi
if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then
echo "---------- Install apcu ----------" echo "---------- Install apcu ----------"
installExtensionFromTgz apcu-5.1.17 pecl install apcu
docker-php-ext-enable apcu
fi fi
if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then
echo "---------- Install memcached ----------" echo "---------- Install memcached ----------"
apk add --no-cache libmemcached-dev zlib-dev apk add --no-cache libmemcached-dev zlib-dev
isPhpVersionGreaterOrEqual 7 0 pecl install memcached-3.2.3
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install memcached-3.1.3
else
printf "\n" | pecl install memcached-2.2.0
fi
docker-php-ext-enable memcached docker-php-ext-enable memcached
fi fi
if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then
echo "---------- Install memcache ----------" echo "---------- Install memcache ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install memcache
if [[ "$?" = "1" ]]; then docker-php-ext-enable memcache
installExtensionFromTgz memcache-4.0.5.2
else
installExtensionFromTgz memcache-2.2.6
fi
fi fi
if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then
echo "---------- Install xdebug ----------" echo "---------- Install xdebug ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz xdebug-3.2.0
if [[ "$?" = "1" ]]; then
isPhpVersionGreaterOrEqual 7 4
if [[ "$?" = "1" ]]; then
installExtensionFromTgz xdebug-2.9.2
else
installExtensionFromTgz xdebug-2.6.1
fi
else
installExtensionFromTgz xdebug-2.5.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,event,*}" ]]; then if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
@ -588,38 +574,27 @@ if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
fi fi
echo "---------- Install event again ----------" echo "---------- Install event again ----------"
installExtensionFromTgz event-2.5.6 "--ini-name event.ini" installExtensionFromTgz event-3.0.5 "--ini-name event.ini"
fi fi
if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then
echo "---------- Install mongodb ----------" echo "---------- Install mongodb ----------"
installExtensionFromTgz mongodb-1.7.4 pecl install mongodb
docker-php-ext-enable mongodb
fi fi
if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then
echo "---------- Install yaf ----------" echo "---------- Install yaf ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install yaf
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install yaf
docker-php-ext-enable yaf docker-php-ext-enable yaf
else
installExtensionFromTgz yaf-2.3.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then
echo "---------- Install swoole ----------" echo "---------- Install swoole ----------"
# Fix: Refer to the line containing "swoole@alpine)" in file "./install-php-extensions" isPhpVersionGreaterOrEqual 8 0
apk add --no-cache libstdc++
isPhpVersionGreaterOrEqual 7 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
installExtensionFromTgz swoole-4.5.2 installExtensionFromTgz swoole-5.0.2 --enable-openssl
else
installExtensionFromTgz swoole-2.0.11
fi fi
fi fi
@ -628,7 +603,7 @@ if [[ -z "${EXTENSIONS##*,zip,*}" ]]; then
# Fix: https://github.com/docker-library/php/issues/797 # Fix: https://github.com/docker-library/php/issues/797
apk add --no-cache libzip-dev apk add --no-cache libzip-dev
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" != "1" ]]; then if [[ "$?" != "1" ]]; then
docker-php-ext-configure zip --with-libzip=/usr/include docker-php-ext-configure zip --with-libzip=/usr/include
fi fi
@ -638,48 +613,39 @@ fi
if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then
echo "---------- Install XHProf ----------" echo "---------- Install XHProf ----------"
pecl install xhprof
isPhpVersionGreaterOrEqual 7 0 docker-php-ext-enable xhprof
if [[ "$?" = "1" ]]; then
mkdir xhprof \
&& tar -xf xhprof-2.2.0.tgz -C xhprof --strip-components=1 \
&& ( cd xhprof/extension/ && phpize && ./configure && make ${MC} && make install ) \
&& docker-php-ext-enable xhprof
else
echo "---------- PHP Version>= 7.0----------"
fi
fi fi
if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then
echo "---------- Install xlswriter ----------" echo "---------- Install xlswriter ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install xlswriter printf "\n" | pecl install xlswriter
docker-php-ext-enable xlswriter docker-php-ext-enable xlswriter
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then
echo "---------- Install rdkafka ----------" echo "---------- Install rdkafka ----------"
isPhpVersionGreaterOrEqual 5 6 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add librdkafka-dev apk add librdkafka-dev
printf "\n" | pecl install rdkafka printf "\n" | pecl install rdkafka
docker-php-ext-enable rdkafka docker-php-ext-enable rdkafka
else else
echo "---------- PHP Version>= 5.6----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
echo "---------- Install zookeeper ----------" echo "---------- Install zookeeper ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add re2c apk add re2c
@ -687,26 +653,26 @@ if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
printf "\n" | pecl install zookeeper printf "\n" | pecl install zookeeper
docker-php-ext-enable zookeeper docker-php-ext-enable zookeeper
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then
echo "---------- Install phalcon ----------" echo "---------- Install phalcon ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install phalcon printf "\n" | pecl install phalcon
docker-php-ext-enable psr docker-php-ext-enable psr
docker-php-ext-enable phalcon docker-php-ext-enable phalcon
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
echo "---------- Install sdebug ----------" echo "---------- Install sdebug ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \ curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \
@ -721,7 +687,7 @@ if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
) \ ) \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -27,9 +27,9 @@ export EXTENSIONS=",${PHP_EXTENSIONS},"
# specific version. # specific version.
# #
# For example, to check if current php is greater than or # For example, to check if current php is greater than or
# equal to PHP 7.0: # equal to PHP 8.0:
# #
# isPhpVersionGreaterOrEqual 7 0 # isPhpVersionGreaterOrEqual 8 0
# #
# Param 1: Specific PHP Major version # Param 1: Specific PHP Major version
# Param 2: Specific PHP Minor version # Param 2: Specific PHP Minor version
@ -62,7 +62,6 @@ installExtensionFromTgz()
tgzName=$1 tgzName=$1
para1= para1=
extensionName="${tgzName%%-*}" extensionName="${tgzName%%-*}"
if [ $2 ]; then if [ $2 ]; then
para1=$2 para1=$2
fi fi
@ -209,9 +208,14 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
# "--with-xxx-dir" was removed from php 7.4, # "--with-xxx-dir" was removed from php 7.4,
@ -380,47 +384,47 @@ fi
if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install ssh2 ----------" echo "---------- Install ssh2 ----------"
printf "\n" | apk add libssh2-dev printf "\n" | apk add libssh2-dev
pecl install ssh2-1.1.2 pecl install ssh2-1.1.2
docker-php-ext-enable ssh2 docker-php-ext-enable ssh2
else else
echo "ssh2 requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "ssh2 requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install protobuf ----------" echo "---------- Install protobuf ----------"
printf "\n" | pecl install protobuf printf "\n" | pecl install protobuf
docker-php-ext-enable protobuf docker-php-ext-enable protobuf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yac ----------" echo "---------- Install yac ----------"
printf "\n" | pecl install yac-2.0.2 printf "\n" | pecl install yac-2.0.2
docker-php-ext-enable yac docker-php-ext-enable yac
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yar ----------" echo "---------- Install yar ----------"
printf "\n" | pecl install yar printf "\n" | pecl install yar
docker-php-ext-enable yar docker-php-ext-enable yar
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -428,13 +432,13 @@ fi
if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yaconf ----------" echo "---------- Install yaconf ----------"
printf "\n" | pecl install yaconf printf "\n" | pecl install yaconf
docker-php-ext-enable yaconf docker-php-ext-enable yaconf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -452,7 +456,7 @@ if [[ -z "${EXTENSIONS##*,varnish,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install pdo_sqlsrv ----------" echo "---------- Install pdo_sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
@ -461,24 +465,24 @@ if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk
apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install sqlsrv ----------" echo "---------- Install sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
printf "\n" | pecl install sqlsrv printf "\n" | pecl install sqlsrv
docker-php-ext-enable sqlsrv docker-php-ext-enable sqlsrv
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install mcrypt ----------" echo "---------- Install mcrypt ----------"
apk add --no-cache libmcrypt-dev libmcrypt re2c apk add --no-cache libmcrypt-dev libmcrypt re2c
@ -492,10 +496,10 @@ if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- mysql was REMOVED from PHP 7.0.0 ----------" echo "---------- mysql was REMOVED from PHP 8.0.0 ----------"
else else
echo "---------- Install mysql ----------" echo "---------- Install mysql ----------"
docker-php-ext-install ${MC} mysql docker-php-ext-install ${MC} mysql
@ -503,10 +507,10 @@ if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo echo
echo "Sodium is bundled with PHP from PHP 7.2.0" echo "Sodium is bundled with PHP from PHP 8.0.0"
echo echo
else else
echo "---------- Install sodium ----------" echo "---------- Install sodium ----------"
@ -517,64 +521,46 @@ fi
if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then
echo "---------- Install amqp ----------" echo "---------- Install amqp ----------"
apk add --no-cache rabbitmq-c-dev apk add --no-cache -U autoconf
installExtensionFromTgz amqp-1.10.2 apk add --no-cache -U gcc
apk add --no-cache -U linux-headers
apk add --no-cache -U libc-dev
apk add --no-cache --update --virtual .phpize-deps-configure $PHPIZE_DEPS \
&& apk add rabbitmq-c-dev \
&& printf '\n' | pecl install amqp \
&& docker-php-ext-enable amqp \
&& apk del .phpize-deps-configure
fi fi
if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then
echo "---------- Install redis ----------" echo "---------- Install redis ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz redis-5.3.7
if [[ "$?" = "1" ]]; then
installExtensionFromTgz redis-5.2.2
else
printf "\n" | pecl install redis-4.3.0
docker-php-ext-enable redis
fi
fi fi
if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then
echo "---------- Install apcu ----------" echo "---------- Install apcu ----------"
installExtensionFromTgz apcu-5.1.17 pecl install apcu
docker-php-ext-enable apcu
fi fi
if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then
echo "---------- Install memcached ----------" echo "---------- Install memcached ----------"
apk add --no-cache libmemcached-dev zlib-dev apk add --no-cache libmemcached-dev zlib-dev
isPhpVersionGreaterOrEqual 7 0 pecl install memcached-3.2.3
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install memcached-3.1.3
else
printf "\n" | pecl install memcached-2.2.0
fi
docker-php-ext-enable memcached docker-php-ext-enable memcached
fi fi
if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then
echo "---------- Install memcache ----------" echo "---------- Install memcache ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install memcache
if [[ "$?" = "1" ]]; then docker-php-ext-enable memcache
installExtensionFromTgz memcache-4.0.5.2
else
installExtensionFromTgz memcache-2.2.6
fi
fi fi
if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then
echo "---------- Install xdebug ----------" echo "---------- Install xdebug ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz xdebug-3.2.0
if [[ "$?" = "1" ]]; then
isPhpVersionGreaterOrEqual 7 4
if [[ "$?" = "1" ]]; then
installExtensionFromTgz xdebug-2.9.2
else
installExtensionFromTgz xdebug-2.6.1
fi
else
installExtensionFromTgz xdebug-2.5.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,event,*}" ]]; then if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
@ -588,38 +574,27 @@ if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
fi fi
echo "---------- Install event again ----------" echo "---------- Install event again ----------"
installExtensionFromTgz event-2.5.6 "--ini-name event.ini" installExtensionFromTgz event-3.0.5 "--ini-name event.ini"
fi fi
if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then
echo "---------- Install mongodb ----------" echo "---------- Install mongodb ----------"
installExtensionFromTgz mongodb-1.7.4 pecl install mongodb
docker-php-ext-enable mongodb
fi fi
if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then
echo "---------- Install yaf ----------" echo "---------- Install yaf ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install yaf
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install yaf
docker-php-ext-enable yaf docker-php-ext-enable yaf
else
installExtensionFromTgz yaf-2.3.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then
echo "---------- Install swoole ----------" echo "---------- Install swoole ----------"
# Fix: Refer to the line containing "swoole@alpine)" in file "./install-php-extensions" isPhpVersionGreaterOrEqual 8 0
apk add --no-cache libstdc++
isPhpVersionGreaterOrEqual 7 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
installExtensionFromTgz swoole-4.5.2 installExtensionFromTgz swoole-5.0.2 --enable-openssl
else
installExtensionFromTgz swoole-2.0.11
fi fi
fi fi
@ -628,7 +603,7 @@ if [[ -z "${EXTENSIONS##*,zip,*}" ]]; then
# Fix: https://github.com/docker-library/php/issues/797 # Fix: https://github.com/docker-library/php/issues/797
apk add --no-cache libzip-dev apk add --no-cache libzip-dev
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" != "1" ]]; then if [[ "$?" != "1" ]]; then
docker-php-ext-configure zip --with-libzip=/usr/include docker-php-ext-configure zip --with-libzip=/usr/include
fi fi
@ -638,48 +613,39 @@ fi
if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then
echo "---------- Install XHProf ----------" echo "---------- Install XHProf ----------"
pecl install xhprof
isPhpVersionGreaterOrEqual 7 0 docker-php-ext-enable xhprof
if [[ "$?" = "1" ]]; then
mkdir xhprof \
&& tar -xf xhprof-2.2.0.tgz -C xhprof --strip-components=1 \
&& ( cd xhprof/extension/ && phpize && ./configure && make ${MC} && make install ) \
&& docker-php-ext-enable xhprof
else
echo "---------- PHP Version>= 7.0----------"
fi
fi fi
if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then
echo "---------- Install xlswriter ----------" echo "---------- Install xlswriter ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install xlswriter printf "\n" | pecl install xlswriter
docker-php-ext-enable xlswriter docker-php-ext-enable xlswriter
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then
echo "---------- Install rdkafka ----------" echo "---------- Install rdkafka ----------"
isPhpVersionGreaterOrEqual 5 6 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add librdkafka-dev apk add librdkafka-dev
printf "\n" | pecl install rdkafka printf "\n" | pecl install rdkafka
docker-php-ext-enable rdkafka docker-php-ext-enable rdkafka
else else
echo "---------- PHP Version>= 5.6----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
echo "---------- Install zookeeper ----------" echo "---------- Install zookeeper ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add re2c apk add re2c
@ -687,26 +653,26 @@ if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
printf "\n" | pecl install zookeeper printf "\n" | pecl install zookeeper
docker-php-ext-enable zookeeper docker-php-ext-enable zookeeper
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then
echo "---------- Install phalcon ----------" echo "---------- Install phalcon ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install phalcon printf "\n" | pecl install phalcon
docker-php-ext-enable psr docker-php-ext-enable psr
docker-php-ext-enable phalcon docker-php-ext-enable phalcon
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
echo "---------- Install sdebug ----------" echo "---------- Install sdebug ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \ curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \
@ -721,7 +687,7 @@ if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
) \ ) \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -27,9 +27,9 @@ export EXTENSIONS=",${PHP_EXTENSIONS},"
# specific version. # specific version.
# #
# For example, to check if current php is greater than or # For example, to check if current php is greater than or
# equal to PHP 7.0: # equal to PHP 8.0:
# #
# isPhpVersionGreaterOrEqual 7 0 # isPhpVersionGreaterOrEqual 8 0
# #
# Param 1: Specific PHP Major version # Param 1: Specific PHP Major version
# Param 2: Specific PHP Minor version # Param 2: Specific PHP Minor version
@ -62,7 +62,6 @@ installExtensionFromTgz()
tgzName=$1 tgzName=$1
para1= para1=
extensionName="${tgzName%%-*}" extensionName="${tgzName%%-*}"
if [ $2 ]; then if [ $2 ]; then
para1=$2 para1=$2
fi fi
@ -209,9 +208,14 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
# "--with-xxx-dir" was removed from php 7.4, # "--with-xxx-dir" was removed from php 7.4,
@ -380,47 +384,47 @@ fi
if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install ssh2 ----------" echo "---------- Install ssh2 ----------"
printf "\n" | apk add libssh2-dev printf "\n" | apk add libssh2-dev
pecl install ssh2-1.1.2 pecl install ssh2-1.1.2
docker-php-ext-enable ssh2 docker-php-ext-enable ssh2
else else
echo "ssh2 requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "ssh2 requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install protobuf ----------" echo "---------- Install protobuf ----------"
printf "\n" | pecl install protobuf printf "\n" | pecl install protobuf
docker-php-ext-enable protobuf docker-php-ext-enable protobuf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yac ----------" echo "---------- Install yac ----------"
printf "\n" | pecl install yac-2.0.2 printf "\n" | pecl install yac-2.0.2
docker-php-ext-enable yac docker-php-ext-enable yac
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yar ----------" echo "---------- Install yar ----------"
printf "\n" | pecl install yar printf "\n" | pecl install yar
docker-php-ext-enable yar docker-php-ext-enable yar
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -428,13 +432,13 @@ fi
if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yaconf ----------" echo "---------- Install yaconf ----------"
printf "\n" | pecl install yaconf printf "\n" | pecl install yaconf
docker-php-ext-enable yaconf docker-php-ext-enable yaconf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -452,7 +456,7 @@ if [[ -z "${EXTENSIONS##*,varnish,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install pdo_sqlsrv ----------" echo "---------- Install pdo_sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
@ -461,24 +465,24 @@ if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk
apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install sqlsrv ----------" echo "---------- Install sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
printf "\n" | pecl install sqlsrv printf "\n" | pecl install sqlsrv
docker-php-ext-enable sqlsrv docker-php-ext-enable sqlsrv
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install mcrypt ----------" echo "---------- Install mcrypt ----------"
apk add --no-cache libmcrypt-dev libmcrypt re2c apk add --no-cache libmcrypt-dev libmcrypt re2c
@ -492,10 +496,10 @@ if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- mysql was REMOVED from PHP 7.0.0 ----------" echo "---------- mysql was REMOVED from PHP 8.0.0 ----------"
else else
echo "---------- Install mysql ----------" echo "---------- Install mysql ----------"
docker-php-ext-install ${MC} mysql docker-php-ext-install ${MC} mysql
@ -503,10 +507,10 @@ if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo echo
echo "Sodium is bundled with PHP from PHP 7.2.0" echo "Sodium is bundled with PHP from PHP 8.0.0"
echo echo
else else
echo "---------- Install sodium ----------" echo "---------- Install sodium ----------"
@ -517,64 +521,46 @@ fi
if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then
echo "---------- Install amqp ----------" echo "---------- Install amqp ----------"
apk add --no-cache rabbitmq-c-dev apk add --no-cache -U autoconf
installExtensionFromTgz amqp-1.10.2 apk add --no-cache -U gcc
apk add --no-cache -U linux-headers
apk add --no-cache -U libc-dev
apk add --no-cache --update --virtual .phpize-deps-configure $PHPIZE_DEPS \
&& apk add rabbitmq-c-dev \
&& printf '\n' | pecl install amqp \
&& docker-php-ext-enable amqp \
&& apk del .phpize-deps-configure
fi fi
if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then
echo "---------- Install redis ----------" echo "---------- Install redis ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz redis-5.3.7
if [[ "$?" = "1" ]]; then
installExtensionFromTgz redis-5.2.2
else
printf "\n" | pecl install redis-4.3.0
docker-php-ext-enable redis
fi
fi fi
if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then
echo "---------- Install apcu ----------" echo "---------- Install apcu ----------"
installExtensionFromTgz apcu-5.1.17 pecl install apcu
docker-php-ext-enable apcu
fi fi
if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then
echo "---------- Install memcached ----------" echo "---------- Install memcached ----------"
apk add --no-cache libmemcached-dev zlib-dev apk add --no-cache libmemcached-dev zlib-dev
isPhpVersionGreaterOrEqual 7 0 pecl install memcached-3.2.3
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install memcached-3.1.3
else
printf "\n" | pecl install memcached-2.2.0
fi
docker-php-ext-enable memcached docker-php-ext-enable memcached
fi fi
if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then
echo "---------- Install memcache ----------" echo "---------- Install memcache ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install memcache
if [[ "$?" = "1" ]]; then docker-php-ext-enable memcache
installExtensionFromTgz memcache-4.0.5.2
else
installExtensionFromTgz memcache-2.2.6
fi
fi fi
if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then
echo "---------- Install xdebug ----------" echo "---------- Install xdebug ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz xdebug-3.2.0
if [[ "$?" = "1" ]]; then
isPhpVersionGreaterOrEqual 7 4
if [[ "$?" = "1" ]]; then
installExtensionFromTgz xdebug-2.9.2
else
installExtensionFromTgz xdebug-2.6.1
fi
else
installExtensionFromTgz xdebug-2.5.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,event,*}" ]]; then if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
@ -588,38 +574,27 @@ if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
fi fi
echo "---------- Install event again ----------" echo "---------- Install event again ----------"
installExtensionFromTgz event-2.5.6 "--ini-name event.ini" installExtensionFromTgz event-3.0.5 "--ini-name event.ini"
fi fi
if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then
echo "---------- Install mongodb ----------" echo "---------- Install mongodb ----------"
installExtensionFromTgz mongodb-1.7.4 pecl install mongodb
docker-php-ext-enable mongodb
fi fi
if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then
echo "---------- Install yaf ----------" echo "---------- Install yaf ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install yaf
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install yaf
docker-php-ext-enable yaf docker-php-ext-enable yaf
else
installExtensionFromTgz yaf-2.3.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then
echo "---------- Install swoole ----------" echo "---------- Install swoole ----------"
# Fix: Refer to the line containing "swoole@alpine)" in file "./install-php-extensions" isPhpVersionGreaterOrEqual 8 0
apk add --no-cache libstdc++
isPhpVersionGreaterOrEqual 7 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
installExtensionFromTgz swoole-4.5.2 installExtensionFromTgz swoole-5.0.2 --enable-openssl
else
installExtensionFromTgz swoole-2.0.11
fi fi
fi fi
@ -628,7 +603,7 @@ if [[ -z "${EXTENSIONS##*,zip,*}" ]]; then
# Fix: https://github.com/docker-library/php/issues/797 # Fix: https://github.com/docker-library/php/issues/797
apk add --no-cache libzip-dev apk add --no-cache libzip-dev
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" != "1" ]]; then if [[ "$?" != "1" ]]; then
docker-php-ext-configure zip --with-libzip=/usr/include docker-php-ext-configure zip --with-libzip=/usr/include
fi fi
@ -638,48 +613,39 @@ fi
if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then
echo "---------- Install XHProf ----------" echo "---------- Install XHProf ----------"
pecl install xhprof
isPhpVersionGreaterOrEqual 7 0 docker-php-ext-enable xhprof
if [[ "$?" = "1" ]]; then
mkdir xhprof \
&& tar -xf xhprof-2.2.0.tgz -C xhprof --strip-components=1 \
&& ( cd xhprof/extension/ && phpize && ./configure && make ${MC} && make install ) \
&& docker-php-ext-enable xhprof
else
echo "---------- PHP Version>= 7.0----------"
fi
fi fi
if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then
echo "---------- Install xlswriter ----------" echo "---------- Install xlswriter ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install xlswriter printf "\n" | pecl install xlswriter
docker-php-ext-enable xlswriter docker-php-ext-enable xlswriter
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then
echo "---------- Install rdkafka ----------" echo "---------- Install rdkafka ----------"
isPhpVersionGreaterOrEqual 5 6 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add librdkafka-dev apk add librdkafka-dev
printf "\n" | pecl install rdkafka printf "\n" | pecl install rdkafka
docker-php-ext-enable rdkafka docker-php-ext-enable rdkafka
else else
echo "---------- PHP Version>= 5.6----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
echo "---------- Install zookeeper ----------" echo "---------- Install zookeeper ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add re2c apk add re2c
@ -687,26 +653,26 @@ if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
printf "\n" | pecl install zookeeper printf "\n" | pecl install zookeeper
docker-php-ext-enable zookeeper docker-php-ext-enable zookeeper
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then
echo "---------- Install phalcon ----------" echo "---------- Install phalcon ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install phalcon printf "\n" | pecl install phalcon
docker-php-ext-enable psr docker-php-ext-enable psr
docker-php-ext-enable phalcon docker-php-ext-enable phalcon
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
echo "---------- Install sdebug ----------" echo "---------- Install sdebug ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \ curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \
@ -721,7 +687,7 @@ if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
) \ ) \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -27,9 +27,9 @@ export EXTENSIONS=",${PHP_EXTENSIONS},"
# specific version. # specific version.
# #
# For example, to check if current php is greater than or # For example, to check if current php is greater than or
# equal to PHP 7.0: # equal to PHP 8.0:
# #
# isPhpVersionGreaterOrEqual 7 0 # isPhpVersionGreaterOrEqual 8 0
# #
# Param 1: Specific PHP Major version # Param 1: Specific PHP Major version
# Param 2: Specific PHP Minor version # Param 2: Specific PHP Minor version
@ -62,7 +62,6 @@ installExtensionFromTgz()
tgzName=$1 tgzName=$1
para1= para1=
extensionName="${tgzName%%-*}" extensionName="${tgzName%%-*}"
if [ $2 ]; then if [ $2 ]; then
para1=$2 para1=$2
fi fi
@ -209,9 +208,14 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
# "--with-xxx-dir" was removed from php 7.4, # "--with-xxx-dir" was removed from php 7.4,
@ -380,47 +384,47 @@ fi
if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install ssh2 ----------" echo "---------- Install ssh2 ----------"
printf "\n" | apk add libssh2-dev printf "\n" | apk add libssh2-dev
pecl install ssh2-1.1.2 pecl install ssh2-1.1.2
docker-php-ext-enable ssh2 docker-php-ext-enable ssh2
else else
echo "ssh2 requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "ssh2 requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install protobuf ----------" echo "---------- Install protobuf ----------"
printf "\n" | pecl install protobuf printf "\n" | pecl install protobuf
docker-php-ext-enable protobuf docker-php-ext-enable protobuf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yac ----------" echo "---------- Install yac ----------"
printf "\n" | pecl install yac-2.0.2 printf "\n" | pecl install yac-2.0.2
docker-php-ext-enable yac docker-php-ext-enable yac
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yar ----------" echo "---------- Install yar ----------"
printf "\n" | pecl install yar printf "\n" | pecl install yar
docker-php-ext-enable yar docker-php-ext-enable yar
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -428,13 +432,13 @@ fi
if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yaconf ----------" echo "---------- Install yaconf ----------"
printf "\n" | pecl install yaconf printf "\n" | pecl install yaconf
docker-php-ext-enable yaconf docker-php-ext-enable yaconf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -452,7 +456,7 @@ if [[ -z "${EXTENSIONS##*,varnish,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install pdo_sqlsrv ----------" echo "---------- Install pdo_sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
@ -461,24 +465,24 @@ if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk
apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install sqlsrv ----------" echo "---------- Install sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
printf "\n" | pecl install sqlsrv printf "\n" | pecl install sqlsrv
docker-php-ext-enable sqlsrv docker-php-ext-enable sqlsrv
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install mcrypt ----------" echo "---------- Install mcrypt ----------"
apk add --no-cache libmcrypt-dev libmcrypt re2c apk add --no-cache libmcrypt-dev libmcrypt re2c
@ -492,10 +496,10 @@ if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- mysql was REMOVED from PHP 7.0.0 ----------" echo "---------- mysql was REMOVED from PHP 8.0.0 ----------"
else else
echo "---------- Install mysql ----------" echo "---------- Install mysql ----------"
docker-php-ext-install ${MC} mysql docker-php-ext-install ${MC} mysql
@ -503,10 +507,10 @@ if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo echo
echo "Sodium is bundled with PHP from PHP 7.2.0" echo "Sodium is bundled with PHP from PHP 8.0.0"
echo echo
else else
echo "---------- Install sodium ----------" echo "---------- Install sodium ----------"
@ -517,64 +521,46 @@ fi
if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then
echo "---------- Install amqp ----------" echo "---------- Install amqp ----------"
apk add --no-cache rabbitmq-c-dev apk add --no-cache -U autoconf
installExtensionFromTgz amqp-1.10.2 apk add --no-cache -U gcc
apk add --no-cache -U linux-headers
apk add --no-cache -U libc-dev
apk add --no-cache --update --virtual .phpize-deps-configure $PHPIZE_DEPS \
&& apk add rabbitmq-c-dev \
&& printf '\n' | pecl install amqp \
&& docker-php-ext-enable amqp \
&& apk del .phpize-deps-configure
fi fi
if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then
echo "---------- Install redis ----------" echo "---------- Install redis ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz redis-5.3.7
if [[ "$?" = "1" ]]; then
installExtensionFromTgz redis-5.2.2
else
printf "\n" | pecl install redis-4.3.0
docker-php-ext-enable redis
fi
fi fi
if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then
echo "---------- Install apcu ----------" echo "---------- Install apcu ----------"
installExtensionFromTgz apcu-5.1.17 pecl install apcu
docker-php-ext-enable apcu
fi fi
if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then
echo "---------- Install memcached ----------" echo "---------- Install memcached ----------"
apk add --no-cache libmemcached-dev zlib-dev apk add --no-cache libmemcached-dev zlib-dev
isPhpVersionGreaterOrEqual 7 0 pecl install memcached-3.2.3
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install memcached-3.1.3
else
printf "\n" | pecl install memcached-2.2.0
fi
docker-php-ext-enable memcached docker-php-ext-enable memcached
fi fi
if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then
echo "---------- Install memcache ----------" echo "---------- Install memcache ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install memcache
if [[ "$?" = "1" ]]; then docker-php-ext-enable memcache
installExtensionFromTgz memcache-4.0.5.2
else
installExtensionFromTgz memcache-2.2.6
fi
fi fi
if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then
echo "---------- Install xdebug ----------" echo "---------- Install xdebug ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz xdebug-3.2.0
if [[ "$?" = "1" ]]; then
isPhpVersionGreaterOrEqual 7 4
if [[ "$?" = "1" ]]; then
installExtensionFromTgz xdebug-2.9.2
else
installExtensionFromTgz xdebug-2.6.1
fi
else
installExtensionFromTgz xdebug-2.5.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,event,*}" ]]; then if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
@ -588,38 +574,27 @@ if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
fi fi
echo "---------- Install event again ----------" echo "---------- Install event again ----------"
installExtensionFromTgz event-2.5.6 "--ini-name event.ini" installExtensionFromTgz event-3.0.5 "--ini-name event.ini"
fi fi
if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then
echo "---------- Install mongodb ----------" echo "---------- Install mongodb ----------"
installExtensionFromTgz mongodb-1.7.4 pecl install mongodb
docker-php-ext-enable mongodb
fi fi
if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then
echo "---------- Install yaf ----------" echo "---------- Install yaf ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install yaf
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install yaf
docker-php-ext-enable yaf docker-php-ext-enable yaf
else
installExtensionFromTgz yaf-2.3.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then
echo "---------- Install swoole ----------" echo "---------- Install swoole ----------"
# Fix: Refer to the line containing "swoole@alpine)" in file "./install-php-extensions" isPhpVersionGreaterOrEqual 8 0
apk add --no-cache libstdc++
isPhpVersionGreaterOrEqual 7 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
installExtensionFromTgz swoole-4.5.2 installExtensionFromTgz swoole-5.0.2 --enable-openssl
else
installExtensionFromTgz swoole-2.0.11
fi fi
fi fi
@ -628,7 +603,7 @@ if [[ -z "${EXTENSIONS##*,zip,*}" ]]; then
# Fix: https://github.com/docker-library/php/issues/797 # Fix: https://github.com/docker-library/php/issues/797
apk add --no-cache libzip-dev apk add --no-cache libzip-dev
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" != "1" ]]; then if [[ "$?" != "1" ]]; then
docker-php-ext-configure zip --with-libzip=/usr/include docker-php-ext-configure zip --with-libzip=/usr/include
fi fi
@ -638,48 +613,39 @@ fi
if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then
echo "---------- Install XHProf ----------" echo "---------- Install XHProf ----------"
pecl install xhprof
isPhpVersionGreaterOrEqual 7 0 docker-php-ext-enable xhprof
if [[ "$?" = "1" ]]; then
mkdir xhprof \
&& tar -xf xhprof-2.2.0.tgz -C xhprof --strip-components=1 \
&& ( cd xhprof/extension/ && phpize && ./configure && make ${MC} && make install ) \
&& docker-php-ext-enable xhprof
else
echo "---------- PHP Version>= 7.0----------"
fi
fi fi
if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then
echo "---------- Install xlswriter ----------" echo "---------- Install xlswriter ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install xlswriter printf "\n" | pecl install xlswriter
docker-php-ext-enable xlswriter docker-php-ext-enable xlswriter
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then
echo "---------- Install rdkafka ----------" echo "---------- Install rdkafka ----------"
isPhpVersionGreaterOrEqual 5 6 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add librdkafka-dev apk add librdkafka-dev
printf "\n" | pecl install rdkafka printf "\n" | pecl install rdkafka
docker-php-ext-enable rdkafka docker-php-ext-enable rdkafka
else else
echo "---------- PHP Version>= 5.6----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
echo "---------- Install zookeeper ----------" echo "---------- Install zookeeper ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add re2c apk add re2c
@ -687,26 +653,26 @@ if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
printf "\n" | pecl install zookeeper printf "\n" | pecl install zookeeper
docker-php-ext-enable zookeeper docker-php-ext-enable zookeeper
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then
echo "---------- Install phalcon ----------" echo "---------- Install phalcon ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install phalcon printf "\n" | pecl install phalcon
docker-php-ext-enable psr docker-php-ext-enable psr
docker-php-ext-enable phalcon docker-php-ext-enable phalcon
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
echo "---------- Install sdebug ----------" echo "---------- Install sdebug ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \ curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \
@ -721,7 +687,7 @@ if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
) \ ) \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi

View File

@ -8,30 +8,29 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh && sh install.sh \
&& rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone
# Fix: https://github.com/docker-library/php/issues/1121 # Fix: https://github.com/docker-library/php/issues/240
RUN apk add --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/v3.13/community/ gnu-libiconv=1.15-r3 RUN apk add gnu-libiconv libstdc++ --no-cache --repository http://${CONTAINER_PACKAGE_URL}/alpine/edge/community/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
# Install composer and change it's cache home # Install composer and change it's cache home
RUN chmod +x install-composer.sh \ RUN curl -o /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar \
&& sh install-composer.sh \ && chmod +x /usr/bin/composer
&& rm -rf /tmp/extensions
ENV COMPOSER_HOME=/tmp/composer ENV COMPOSER_HOME=/tmp/composer
# php image's www-data user uid & gid are 82, change them to 1000 (primary user) # php image's www-data user uid & gid are 82, change them to 1000 (primary user)

View File

@ -27,9 +27,9 @@ export EXTENSIONS=",${PHP_EXTENSIONS},"
# specific version. # specific version.
# #
# For example, to check if current php is greater than or # For example, to check if current php is greater than or
# equal to PHP 7.0: # equal to PHP 8.0:
# #
# isPhpVersionGreaterOrEqual 7 0 # isPhpVersionGreaterOrEqual 8 0
# #
# Param 1: Specific PHP Major version # Param 1: Specific PHP Major version
# Param 2: Specific PHP Minor version # Param 2: Specific PHP Minor version
@ -62,7 +62,6 @@ installExtensionFromTgz()
tgzName=$1 tgzName=$1
para1= para1=
extensionName="${tgzName%%-*}" extensionName="${tgzName%%-*}"
if [ $2 ]; then if [ $2 ]; then
para1=$2 para1=$2
fi fi
@ -209,9 +208,14 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
# "--with-xxx-dir" was removed from php 7.4, # "--with-xxx-dir" was removed from php 7.4,
@ -380,47 +384,47 @@ fi
if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then if [[ -z "${EXTENSIONS##*,ssh2,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install ssh2 ----------" echo "---------- Install ssh2 ----------"
printf "\n" | apk add libssh2-dev printf "\n" | apk add libssh2-dev
pecl install ssh2-1.1.2 pecl install ssh2-1.1.2
docker-php-ext-enable ssh2 docker-php-ext-enable ssh2
else else
echo "ssh2 requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "ssh2 requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then if [[ -z "${EXTENSIONS##*,protobuf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install protobuf ----------" echo "---------- Install protobuf ----------"
printf "\n" | pecl install protobuf printf "\n" | pecl install protobuf
docker-php-ext-enable protobuf docker-php-ext-enable protobuf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then if [[ -z "${EXTENSIONS##*,yac,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yac ----------" echo "---------- Install yac ----------"
printf "\n" | pecl install yac-2.0.2 printf "\n" | pecl install yac-2.0.2
docker-php-ext-enable yac docker-php-ext-enable yac
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then if [[ -z "${EXTENSIONS##*,yar,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yar ----------" echo "---------- Install yar ----------"
printf "\n" | pecl install yar printf "\n" | pecl install yar
docker-php-ext-enable yar docker-php-ext-enable yar
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -428,13 +432,13 @@ fi
if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaconf,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install yaconf ----------" echo "---------- Install yaconf ----------"
printf "\n" | pecl install yaconf printf "\n" | pecl install yaconf
docker-php-ext-enable yaconf docker-php-ext-enable yaconf
else else
echo "yar requires PHP >= 7.0.0, installed version is ${PHP_VERSION}" echo "yar requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
@ -452,7 +456,7 @@ if [[ -z "${EXTENSIONS##*,varnish,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install pdo_sqlsrv ----------" echo "---------- Install pdo_sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
@ -461,24 +465,24 @@ if [[ -z "${EXTENSIONS##*,pdo_sqlsrv,*}" ]]; then
curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk curl -o /tmp/msodbcsql17_amd64.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk
apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk apk add --allow-untrusted /tmp/msodbcsql17_amd64.apk
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then if [[ -z "${EXTENSIONS##*,sqlsrv,*}" ]]; then
isPhpVersionGreaterOrEqual 7 1 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install sqlsrv ----------" echo "---------- Install sqlsrv ----------"
apk add --no-cache unixodbc-dev apk add --no-cache unixodbc-dev
printf "\n" | pecl install sqlsrv printf "\n" | pecl install sqlsrv
docker-php-ext-enable sqlsrv docker-php-ext-enable sqlsrv
else else
echo "pdo_sqlsrv requires PHP >= 7.1.0, installed version is ${PHP_VERSION}" echo "pdo_sqlsrv requires PHP >= 8.0.0, installed version is ${PHP_VERSION}"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- Install mcrypt ----------" echo "---------- Install mcrypt ----------"
apk add --no-cache libmcrypt-dev libmcrypt re2c apk add --no-cache libmcrypt-dev libmcrypt re2c
@ -492,10 +496,10 @@ if [[ -z "${EXTENSIONS##*,mcrypt,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo "---------- mysql was REMOVED from PHP 7.0.0 ----------" echo "---------- mysql was REMOVED from PHP 8.0.0 ----------"
else else
echo "---------- Install mysql ----------" echo "---------- Install mysql ----------"
docker-php-ext-install ${MC} mysql docker-php-ext-install ${MC} mysql
@ -503,10 +507,10 @@ if [[ -z "${EXTENSIONS##*,mysql,*}" ]]; then
fi fi
if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then if [[ -z "${EXTENSIONS##*,sodium,*}" ]]; then
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
echo echo
echo "Sodium is bundled with PHP from PHP 7.2.0" echo "Sodium is bundled with PHP from PHP 8.0.0"
echo echo
else else
echo "---------- Install sodium ----------" echo "---------- Install sodium ----------"
@ -517,64 +521,46 @@ fi
if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then if [[ -z "${EXTENSIONS##*,amqp,*}" ]]; then
echo "---------- Install amqp ----------" echo "---------- Install amqp ----------"
apk add --no-cache rabbitmq-c-dev apk add --no-cache -U autoconf
installExtensionFromTgz amqp-1.10.2 apk add --no-cache -U gcc
apk add --no-cache -U linux-headers
apk add --no-cache -U libc-dev
apk add --no-cache --update --virtual .phpize-deps-configure $PHPIZE_DEPS \
&& apk add rabbitmq-c-dev \
&& printf '\n' | pecl install amqp \
&& docker-php-ext-enable amqp \
&& apk del .phpize-deps-configure
fi fi
if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then
echo "---------- Install redis ----------" echo "---------- Install redis ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz redis-5.3.7
if [[ "$?" = "1" ]]; then
installExtensionFromTgz redis-5.2.2
else
printf "\n" | pecl install redis-4.3.0
docker-php-ext-enable redis
fi
fi fi
if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then
echo "---------- Install apcu ----------" echo "---------- Install apcu ----------"
installExtensionFromTgz apcu-5.1.17 pecl install apcu
docker-php-ext-enable apcu
fi fi
if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcached,*}" ]]; then
echo "---------- Install memcached ----------" echo "---------- Install memcached ----------"
apk add --no-cache libmemcached-dev zlib-dev apk add --no-cache libmemcached-dev zlib-dev
isPhpVersionGreaterOrEqual 7 0 pecl install memcached-3.2.3
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install memcached-3.1.3
else
printf "\n" | pecl install memcached-2.2.0
fi
docker-php-ext-enable memcached docker-php-ext-enable memcached
fi fi
if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then if [[ -z "${EXTENSIONS##*,memcache,*}" ]]; then
echo "---------- Install memcache ----------" echo "---------- Install memcache ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install memcache
if [[ "$?" = "1" ]]; then docker-php-ext-enable memcache
installExtensionFromTgz memcache-4.0.5.2
else
installExtensionFromTgz memcache-2.2.6
fi
fi fi
if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,xdebug,*}" ]]; then
echo "---------- Install xdebug ----------" echo "---------- Install xdebug ----------"
isPhpVersionGreaterOrEqual 7 0 installExtensionFromTgz xdebug-3.2.0
if [[ "$?" = "1" ]]; then
isPhpVersionGreaterOrEqual 7 4
if [[ "$?" = "1" ]]; then
installExtensionFromTgz xdebug-2.9.2
else
installExtensionFromTgz xdebug-2.6.1
fi
else
installExtensionFromTgz xdebug-2.5.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,event,*}" ]]; then if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
@ -588,38 +574,27 @@ if [[ -z "${EXTENSIONS##*,event,*}" ]]; then
fi fi
echo "---------- Install event again ----------" echo "---------- Install event again ----------"
installExtensionFromTgz event-2.5.6 "--ini-name event.ini" installExtensionFromTgz event-3.0.5 "--ini-name event.ini"
fi fi
if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then if [[ -z "${EXTENSIONS##*,mongodb,*}" ]]; then
echo "---------- Install mongodb ----------" echo "---------- Install mongodb ----------"
installExtensionFromTgz mongodb-1.7.4 pecl install mongodb
docker-php-ext-enable mongodb
fi fi
if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then if [[ -z "${EXTENSIONS##*,yaf,*}" ]]; then
echo "---------- Install yaf ----------" echo "---------- Install yaf ----------"
isPhpVersionGreaterOrEqual 7 0 pecl install yaf
if [[ "$?" = "1" ]]; then
printf "\n" | pecl install yaf
docker-php-ext-enable yaf docker-php-ext-enable yaf
else
installExtensionFromTgz yaf-2.3.5
fi
fi fi
if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then if [[ -z "${EXTENSIONS##*,swoole,*}" ]]; then
echo "---------- Install swoole ----------" echo "---------- Install swoole ----------"
# Fix: Refer to the line containing "swoole@alpine)" in file "./install-php-extensions" isPhpVersionGreaterOrEqual 8 0
apk add --no-cache libstdc++
isPhpVersionGreaterOrEqual 7 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
installExtensionFromTgz swoole-4.5.2 installExtensionFromTgz swoole-5.0.2 --enable-openssl
else
installExtensionFromTgz swoole-2.0.11
fi fi
fi fi
@ -628,7 +603,7 @@ if [[ -z "${EXTENSIONS##*,zip,*}" ]]; then
# Fix: https://github.com/docker-library/php/issues/797 # Fix: https://github.com/docker-library/php/issues/797
apk add --no-cache libzip-dev apk add --no-cache libzip-dev
isPhpVersionGreaterOrEqual 7 4 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" != "1" ]]; then if [[ "$?" != "1" ]]; then
docker-php-ext-configure zip --with-libzip=/usr/include docker-php-ext-configure zip --with-libzip=/usr/include
fi fi
@ -638,48 +613,39 @@ fi
if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then if [[ -z "${EXTENSIONS##*,xhprof,*}" ]]; then
echo "---------- Install XHProf ----------" echo "---------- Install XHProf ----------"
pecl install xhprof
isPhpVersionGreaterOrEqual 7 0 docker-php-ext-enable xhprof
if [[ "$?" = "1" ]]; then
mkdir xhprof \
&& tar -xf xhprof-2.2.0.tgz -C xhprof --strip-components=1 \
&& ( cd xhprof/extension/ && phpize && ./configure && make ${MC} && make install ) \
&& docker-php-ext-enable xhprof
else
echo "---------- PHP Version>= 7.0----------"
fi
fi fi
if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then if [[ -z "${EXTENSIONS##*,xlswriter,*}" ]]; then
echo "---------- Install xlswriter ----------" echo "---------- Install xlswriter ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install xlswriter printf "\n" | pecl install xlswriter
docker-php-ext-enable xlswriter docker-php-ext-enable xlswriter
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then if [[ -z "${EXTENSIONS##*,rdkafka,*}" ]]; then
echo "---------- Install rdkafka ----------" echo "---------- Install rdkafka ----------"
isPhpVersionGreaterOrEqual 5 6 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add librdkafka-dev apk add librdkafka-dev
printf "\n" | pecl install rdkafka printf "\n" | pecl install rdkafka
docker-php-ext-enable rdkafka docker-php-ext-enable rdkafka
else else
echo "---------- PHP Version>= 5.6----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
echo "---------- Install zookeeper ----------" echo "---------- Install zookeeper ----------"
isPhpVersionGreaterOrEqual 7 0 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
apk add re2c apk add re2c
@ -687,26 +653,26 @@ if [[ -z "${EXTENSIONS##*,zookeeper,*}" ]]; then
printf "\n" | pecl install zookeeper printf "\n" | pecl install zookeeper
docker-php-ext-enable zookeeper docker-php-ext-enable zookeeper
else else
echo "---------- PHP Version>= 7.0----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then if [[ -z "${EXTENSIONS##*,phalcon,*}" ]]; then
echo "---------- Install phalcon ----------" echo "---------- Install phalcon ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
printf "\n" | pecl install phalcon printf "\n" | pecl install phalcon
docker-php-ext-enable psr docker-php-ext-enable psr
docker-php-ext-enable phalcon docker-php-ext-enable phalcon
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi
if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
echo "---------- Install sdebug ----------" echo "---------- Install sdebug ----------"
isPhpVersionGreaterOrEqual 7 2 isPhpVersionGreaterOrEqual 8 0
if [[ "$?" = "1" ]]; then if [[ "$?" = "1" ]]; then
curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \ curl -SL "https://github.com/swoole/sdebug/archive/sdebug_2_9-beta.tar.gz" -o sdebug.tar.gz \
@ -721,7 +687,7 @@ if [[ -z "${EXTENSIONS##*,sdebug,*}" ]]; then
) \ ) \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug
else else
echo "---------- PHP Version>= 7.2----------" echo "---------- PHP Version>= 8.0----------"
fi fi
fi fi

View File

@ -8,16 +8,16 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh \ && sh install.sh \
&& rm -rf /tmp/extensions && rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone

View File

@ -208,6 +208,11 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 8 0 isPhpVersionGreaterOrEqual 8 0

View File

@ -8,16 +8,16 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh \ && sh install.sh \
&& rm -rf /tmp/extensions && rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone

View File

@ -208,6 +208,11 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 8 0 isPhpVersionGreaterOrEqual 8 0

View File

@ -8,16 +8,16 @@ ARG CONTAINER_PACKAGE_URL
RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
COPY ./extensions /tmp/extensions COPY ./extensions /tmp/extensions
WORKDIR /tmp/extensions WORKDIR /tmp/extensions
RUN chmod +x install.sh \ RUN chmod +x install.sh \
&& sh install.sh \ && sh install.sh \
&& rm -rf /tmp/extensions && rm -rf /tmp/extensions
ADD ./extensions/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions
RUN apk --no-cache add tzdata \ RUN apk --no-cache add tzdata \
&& cp "/usr/share/zoneinfo/$TZ" /etc/localtime \ && cp "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone && echo "$TZ" > /etc/timezone

View File

@ -208,6 +208,11 @@ if [[ -z "${EXTENSIONS##*,hprose,*}" ]]; then
docker-php-ext-enable hprose docker-php-ext-enable hprose
fi fi
if [[ -z "${EXTENSIONS##*,ioncube_loader,*}" ]]; then
echo "---------- Install ioncube_loader ----------"
install-php-extensions ioncube_loader
fi
if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then if [[ -z "${EXTENSIONS##*,gd,*}" ]]; then
echo "---------- Install gd ----------" echo "---------- Install gd ----------"
isPhpVersionGreaterOrEqual 8 0 isPhpVersionGreaterOrEqual 8 0