Skip to content

Commit

Permalink
Merge pull request #18 from mlocati/master
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
vanderletenpartners authored Mar 1, 2024
2 parents c60c645 + a285464 commit faf6b8b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 25 deletions.
5 changes: 5 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ We should switch to the stable release once it will be available.
The only available versions of the `parle` PHP extension are all beta.
We should switch to the stable release once it will be available.

### saxon

The `saxon` PHP extension is not available in the PECL archive, so we install it manually.
We need to monitor new releases at https://www.saxonica.com/download/c.xml

### snappy

The `snappy` PHP extension is not available in the PECL archive, so we install it manually.
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Downloaded GitHub Releases](https://img.shields.io/github/downloads/mlocati/docker-php-extension-installer/total?label=Downloaded%20releases)](https://github.com/mlocati/docker-php-extension-installer/releases)
[![Docker Hub pulls](https://img.shields.io/docker/pulls/mlocati/php-extension-installer)](https://hub.docker.com/r/mlocati/php-extension-installer)
[![Test recent](https://github.com/mlocati/docker-php-extension-installer/workflows/Test%20recent/badge.svg)](https://github.com/mlocati/docker-php-extension-installer/actions?query=workflow%3A%22Test+recent%22)
[![Test recent](https://github.com/mlocati/docker-php-extension-installer/actions/workflows/test-recent-extensions.yml/badge.svg)](https://github.com/mlocati/docker-php-extension-installer/actions/workflows/test-recent-extensions.yml)

# Easy installation of PHP extensions in official PHP Docker images

Expand All @@ -26,10 +26,9 @@ Here's a list of sample `Dockerfile`s that install the GD and xdebug PHP extensi
```Dockerfile
FROM php:7.2-cli

ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions gd xdebug
RUN install-php-extensions gd xdebug
```

### Downloading the script on the fly with `curl`
Expand Down Expand Up @@ -296,6 +295,7 @@ install-php-extensions @fix_letsencrypt
| recode | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | |
| redis | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| relay | | | | | | | ✓ | ✓ | ✓ | ✓ | ✓ |
| saxon[*](#special-requirements-for-saxon) | | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| seasclick | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| seaslog | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| shmop | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Expand Down Expand Up @@ -346,7 +346,7 @@ install-php-extensions @fix_letsencrypt
| zookeeper | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| zstd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |

*Number of supported extensions: 143*
*Number of supported extensions: 144*
<!-- END OF EXTENSIONS TABLE -->

PS: the pre-installed PHP extensions are excluded from this list.
Expand Down Expand Up @@ -407,12 +407,12 @@ Here's the list of all the supported environment variables:
| Extension | Environment variable | Description |
|---|---|---|
| | `IPE_DEBUG=1` | By setting this environment variable, the script will print all the commands it executes (it will be very verbose, useful only for debug purposes) |
| | `IPE_PROCESSOR_COUNT` | Set this environment variable to override the number of processors detected by the script (used for parallel compilation) |
| | `IPE_DONT_ENABLE=1` | By default the script will install and enable the extensions.<br />If you want to only install them (without enabling them) you can set this environment variable.<br />To enable the extensions at a later time you can execute the command `docker-php-ext-enable-<extension>` (for example: `docker-php-ext-enable-xdebug`).<br />**Beware**: installing some PHP extensions require that other PHP extensions are already enabled, so use this feature wisely. |
| | `IPE_PROCESSOR_COUNT` | By default all available processors. Set this environment variable to override the number of processors detected by the script (used for parallel compilation) |
| | `IPE_DONT_ENABLE=1` | By default the script will install and enable the extensions.<br />If you want to only install them (without enabling them) you can set this environment variable.<br />To enable the extensions at a later time you can execute the command `docker-php-ext-enable-<extension>` (for example: `docker-php-ext-enable-xdebug`).<br />**Beware**: installing some PHP extensions requires that other PHP extensions are already enabled, so use this feature wisely. |
| | `IPE_KEEP_SYSPKG_CACHE=1` | By default the script will clear the apt/apk/pear cache in order to save disk space. You can disable it by setting this environment variable |
| lzf | `IPE_LZF_BETTERCOMPRESSION=1` | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed |
| event | `IPE_EVENT_NAMESPACE=`... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace |
| gd | `IPE_GD_WITHOUTAVIF=1` | Since PHP 8.1, gd supports the AVIF format. Enabling it requires compiling libaom/libdav1d/libyuv/libavif on Debian and Alpine 3.14-, which is time-consuming. You can disable AVIF support by setting this environment variable on Debian and Alpine 3.14- |
| event | `IPE_EVENT_NAMESPACE=`... | By default, the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace |
| gd | `IPE_GD_WITHOUTAVIF=1` | Since PHP 8.1, gd supports the AVIF format. Enabling it requires compiling libaom/libdav1d/libyuv/libavif on Debian 11- and Alpine 3.14-, which is time-consuming. You can disable AVIF support by setting this environment variable on Debian 11- and Alpine 3.14- |
| oci8 & pdo_oci | `IPE_INSTANTCLIENT_BASIC=1` | The oci8 and pdo_oci PHP extensions require [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client.html). In order to save disk space, we install the Basic Lite version: if you want to install the Basic (non-lite) version simply set this environment variable |
| http, intl, mongodb | `IPE_ICU_EN_ONLY=1` | Some extensions require the ICU library, use this flag to install a smaller, but English-only, ICU library on Alpine 3.16 and later |
| pspell | `IPE_ASPELL_LANGUAGES='...'` | Configure the languages to be made available (for example: `IPE_ASPELL_LANGUAGES='en fr'`). If omitted, we'll assume `en` |
Expand Down Expand Up @@ -442,6 +442,7 @@ Some extensions have special requirements:
| <a name="special-requirements-for-parle"></a>parle | Not available in `jessie` docker images |
| <a name="special-requirements-for-pdo_sqlsrv"></a>pdo_sqlsrv | Not available in ARM architectures |
| <a name="special-requirements-for-pthreads"></a>pthreads | Requires images with PHP compiled with thread-safety enabled (`zts`) |
| <a name="special-requirements-for-saxon"></a>saxon | Not available in `alpine` docker images |
| <a name="special-requirements-for-simdjson"></a>simdjson | &bull; Not available in `jessie` docker images<br />&bull; Not available in `stretch` docker images |
| <a name="special-requirements-for-sodium"></a>sodium | Not available in `jessie` docker images |
| <a name="special-requirements-for-sqlsrv"></a>sqlsrv | &bull; Not available in `7.1-alpine3.9` docker images<br />&bull; Not available in `7.1-alpine3.10` docker images<br />&bull; Not available in ARM architectures |
Expand Down
1 change: 1 addition & 0 deletions data/special-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ parallel zts
parle !jessie
pdo_sqlsrv !arm
pthreads zts
saxon !alpine
simdjson !jessie !stretch
sodium !jessie
sqlsrv !7.1-alpine3.9 !7.1-alpine3.10 !arm
Expand Down
1 change: 1 addition & 0 deletions data/supported-extensions
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ rdkafka 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
recode 5.5 5.6 7.0 7.1 7.2 7.3
redis 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
relay 7.4 8.0 8.1 8.2 8.3
saxon 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
seasclick 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
seaslog 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
shmop 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
Expand Down
57 changes: 41 additions & 16 deletions install-php-extensions
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ resolvePHPModuleVersion() {
resolvePHPModuleVersion_wantedVersion="$resolvePHPModuleVersion_afterCaret"
;;
esac
resolvePHPModuleVersion_xml="$(curl -sSLf "http://pecl.php.net/rest/r/$resolvePHPModuleVersion_module/allreleases.xml")"
resolvePHPModuleVersion_peclModule="$(getPeclModuleName "$resolvePHPModuleVersion_module")"
resolvePHPModuleVersion_xml="$(curl -sSLf "http://pecl.php.net/rest/r/$resolvePHPModuleVersion_peclModule/allreleases.xml")"
# remove line endings, collapse spaces
resolvePHPModuleVersion_versions="$(printf '%s' "$resolvePHPModuleVersion_xml" | tr -s ' \t\r\n' ' ')"
# one line per release (eg <r><v>1.2.3</v><s>stable</s></r>)
Expand Down Expand Up @@ -449,7 +450,8 @@ resolvePeclStabilityVersion() {
return
;;
esac
peclStabilityFlagToVersion_url="http://pecl.php.net/rest/r/$1/$2.txt"
resolvePeclStabilityVersion_peclModule="$(getPeclModuleName "$1")"
peclStabilityFlagToVersion_url="http://pecl.php.net/rest/r/$resolvePeclStabilityVersion_peclModule/$2.txt"
if ! peclStabilityFlagToVersion_result="$(curl -sSLf "$peclStabilityFlagToVersion_url")"; then
peclStabilityFlagToVersion_result=''
fi
Expand Down Expand Up @@ -860,7 +862,10 @@ buildRequiredPackageLists() {
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libwebp[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libwebp-dev"
if test $PHP_MAJMIN_VERSION -ge 801; then
if ! isLibaomInstalled || ! isLibdav1dInstalled || ! isLibyuvInstalled || ! isLibavifInstalled; then
if test $DISTRO_VERSION_NUMBER -ge 12; then
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libavif[0-9]+$ ^libaom[0-9]+$ ^libdav1d[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libavif-dev libaom-dev libdav1d-dev"
elif ! isLibaomInstalled || ! isLibdav1dInstalled || ! isLibyuvInstalled || ! isLibavifInstalled; then
case "${IPE_GD_WITHOUTAVIF:-}" in
1 | y* | Y*) ;;
*)
Expand Down Expand Up @@ -2051,7 +2056,7 @@ installMicrosoftSqlServerODBC() {
alpine)
rm -rf /tmp/src/msodbcsql.apk
if test $PHP_MAJMIN_VERSION -le 703; then
curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.9.1.1-1_amd64.apk
curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.10.5.1-1_amd64.apk
else
case $(uname -m) in
aarch64 | arm64 | armv8)
Expand All @@ -2061,7 +2066,7 @@ installMicrosoftSqlServerODBC() {
installMicrosoftSqlServerODBC_arch=amd64
;;
esac
curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.1.1-1_$installMicrosoftSqlServerODBC_arch.apk
curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.2.1-1_$installMicrosoftSqlServerODBC_arch.apk
fi
printf '\n' | apk add --allow-untrusted /tmp/src/msodbcsql.apk
rm -rf /tmp/src/msodbcsql.apk
Expand Down Expand Up @@ -2100,7 +2105,7 @@ installMicrosoftSqlServerODBC() {
# 0 (true)
# 1 (false)
isLibaomInstalled() {
if ! test -f /usr/local/lib/libaom.so && ! test -f /usr/lib/libaom.so; then
if ! test -f /usr/local/lib/libaom.so && ! test -f /usr/lib/libaom.so && ! test -f /usr/lib/x86_64*/libaom.so; then
return 1
fi
if ! test -f /usr/local/include/aom/aom_codec.h && ! test -f /usr/include/aom/aom_codec.h; then
Expand All @@ -2112,7 +2117,18 @@ isLibaomInstalled() {
# Install libaom
installLibaom() {
printf 'Installing libaom\n'
installLibaom_dir="$(getPackageSource https://aomedia.googlesource.com/aom/+archive/v3.3.0.tar.gz)"
installLibaom_version=3.8.1
case "$DISTRO_VERSION" in
debian@10)
case $(uname -m) in
aarch* | arm*)
#see https://bugs.chromium.org/p/aomedia/issues/detail?id=3543
installLibaom_version=3.5.0
;;
esac
;;
esac
installLibaom_dir="$(getPackageSource https://aomedia.googlesource.com/aom/+archive/v$installLibaom_version.tar.gz)"
mkdir -- "$installLibaom_dir/my.build"
cd -- "$installLibaom_dir/my.build"
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCMAKE_INSTALL_LIBDIR:PATH=lib ..
Expand All @@ -2139,7 +2155,7 @@ isLibdav1dInstalled() {
# Install libdav1d
installLibdav1d() {
printf 'Installing libdav1d\n'
installLibdav1d_dir="$(getPackageSource https://code.videolan.org/videolan/dav1d/-/archive/0.9.2/dav1d-0.9.2.tar.gz)"
installLibdav1d_dir="$(getPackageSource https://github.com/videolan/dav1d/archive/refs/tags/1.3.0.tar.gz)"
mkdir -- "$installLibdav1d_dir/build"
cd -- "$installLibdav1d_dir/build"
meson --buildtype release -Dprefix=/usr ..
Expand All @@ -2157,7 +2173,7 @@ installLibdav1d() {
# 0 (true)
# 1 (false)
isLibyuvInstalled() {
if ! test -f /usr/local/lib/libyuv.so && ! test -f /usr/lib/libyuv.so && ! test -f /usr/lib/x86_64*/libyuv.so; then
if ! test -f /usr/local/lib/libyuv.so && ! test -f /usr/lib/libyuv.so && ! test -f /usr/lib/x86_64*/libyuv.so && ! test -f /usr/lib/x86_64*/libyuv.so.*; then
return 1
fi
if ! test -f /usr/local/include/libyuv.h && ! test -f /usr/include/libyuv.h; then
Expand All @@ -2169,7 +2185,7 @@ isLibyuvInstalled() {
# Install libyuv
installLibyuv() {
printf 'Installing libyuv\n'
installLibyuv_dir="$(getPackageSource https://chromium.googlesource.com/libyuv/libyuv/+archive/25d0a5110be796eef47004412baf43333d9ecf26.tar.gz)"
installLibyuv_dir="$(getPackageSource https://chromium.googlesource.com/libyuv/libyuv/+archive/d359a9f922af840b043535d43cf9d38b220d102e.tar.gz)"
mkdir -- "$installLibyuv_dir/build"
cd -- "$installLibyuv_dir/build"
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -B. ..
Expand All @@ -2195,7 +2211,7 @@ isLibavifInstalled() {
# Install libavif
installLibavif() {
printf 'Installing libavif\n'
installLibavif_dir="$(getPackageSource https://codeload.github.com/AOMediaCodec/libavif/tar.gz/refs/tags/v0.9.3)"
installLibavif_dir="$(getPackageSource https://codeload.github.com/AOMediaCodec/libavif/tar.gz/refs/tags/v1.0.3)"
mkdir -- "$installLibavif_dir/build"
cd -- "$installLibavif_dir/build"
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DAVIF_CODEC_AOM=ON -DCMAKE_INSTALL_LIBDIR:PATH=lib
Expand Down Expand Up @@ -2433,6 +2449,11 @@ EOF
installBundledModule_tmp=1
fi
;;
debian)
if test $DISTRO_VERSION_NUMBER -ge 12; then
installBundledModule_tmp=1
fi
;;
esac
if test $installBundledModule_tmp -eq 0; then
case "${IPE_GD_WITHOUTAVIF:-}" in
Expand Down Expand Up @@ -2760,9 +2781,12 @@ installRemoteModule() {
if test -z "$installRemoteModule_version"; then
if test $PHP_MAJMIN_VERSION -lt 700; then
installRemoteModule_version=0.75.0
else
installCargo
fi
else
installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")"
fi
if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 0.75.0) -ge 0; then
installCargo
fi
;;
decimal)
Expand Down Expand Up @@ -3493,8 +3517,8 @@ installRemoteModule() {
;;
saxon)
if test -z "$installRemoteModule_version"; then
if test $PHP_MAJMIN_VERSION -le 506; then
installRemoteModule_version='11.6'
if test $PHP_MAJMIN_VERSION -ge 800; then
installRemoteModule_version='12.4.2'
else
installRemoteModule_version='12.3'
fi
Expand Down Expand Up @@ -3522,7 +3546,6 @@ installRemoteModule() {
ldconfig || true
fi
cd "$installRemoteModule_dir/Saxon.C.API"
exit
phpize
./configure --enable-saxon
make -j$(getProcessorCount) install
Expand Down Expand Up @@ -3632,6 +3655,8 @@ installRemoteModule() {
installRemoteModule_version=5.9.0
elif test $PHP_MAJMIN_VERSION -le 704; then
installRemoteModule_version=5.10.1
elif test $PHP_MAJMIN_VERSION -le 800; then
installRemoteModule_version=5.11.1
fi
fi
;;
Expand Down
1 change: 1 addition & 0 deletions scripts/check-installed-extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'opcache' => 'Zend OPcache',
'apcu_bc' => 'apc',
'ioncube_loader' => 'ionCube Loader',
'saxon' => 'saxonc',
];
if (PHP_VERSION_ID < 70000) {
$nameMap['sodium'] = 'libsodium';
Expand Down

0 comments on commit faf6b8b

Please sign in to comment.