Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions 8/install-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ php_minor=$(php -r 'echo PHP_MAJOR_VERSION, ".", PHP_MINOR_VERSION;')
# version ship without them until upstream catches up: https://github.com/wodby/php/issues/274
# Keep this in step with the Dockerfile (New Relic, SPX) and tests/php_modules.
declare -A unavailable=(
[8.6]="amqp apcu ds grpc igbinary imagick imap memcached oauth pcov pdo_sqlsrv protobuf rdkafka redis smbclient sqlsrv uploadprogress xdebug yaml"
[8.6]="amqp apcu ds grpc igbinary imagick imap memcached oauth pcov protobuf rdkafka redis smbclient uploadprogress xdebug yaml"
)

# Succeed when module $1 has a release for this PHP version.
Expand Down Expand Up @@ -63,6 +63,26 @@ install_source() {
rm -rf "${source_dir}" "${archive}"
}

# Build an exact release archive published outside PECL, with its sources at the archive root.
install_release() {
local name=$1 url=$2 checksum=$3
shift 3
local archive="${build_dir}/${name}.tgz"
local source_dir="${build_dir}/${name}"
curl --fail --show-error --location --retry 3 --retry-connrefused "${url}" --output "${archive}"
echo "${checksum} ${archive}" | sha256sum -c -
mkdir -p "${source_dir}"
tar -xzf "${archive}" -C "${source_dir}"
(
cd "${source_dir}"
phpize
./configure --with-php-config=/usr/local/bin/php-config "$@"
make -j "${jobs}"
make install
)
rm -rf "${source_dir}" "${archive}"
}

# Install module $1 through PIE or a release archive, unless it is unavailable here.
pie_for() {
local module=$1
Expand All @@ -86,6 +106,17 @@ source_for() {
echo "${module}" >> "${PHP_INI_DIR}/unavailable-extensions"
fi
}
release_for() {
local module=$1
shift
if supported "${module}"; then
install_release "${module}" "$@"
else
echo "Skipping ${module}: no release for PHP ${php_minor}"
# The entrypoint reads this to accept the module in PHP_EXTENSIONS_DISABLE.
echo "${module}" >> "${PHP_INI_DIR}/unavailable-extensions"
fi
}

pie_for apcu apcu/apcu:5.1.28
pie_for amqp php-amqp/php-amqp:2.2.0
Expand All @@ -107,11 +138,18 @@ if [[ "${php_minor}" == 8.2 ]]; then
# Microsoft's PIE packages require PHP >= 8.3; preserve the 8.2 driver pins.
source_for pdo_sqlsrv pdo_sqlsrv-5.12.0 22f0cb17b45f0deccd0bba072ee0085ff4094cd6ee2acc26f7f924975ef652c6 .
source_for sqlsrv sqlsrv-5.12.0 a9ebb880b2a558d3d6684f6e6802c53c5bffa49e1ee60d1473a7124fc9cb72ad .
else
# Use the exact release archives without GitHub API discovery. Anonymous PIE
# lookups can fail authentication while resolving these packaged sources.
elif [[ "${php_minor}" == 8.3 ]]; then
# 5.14.0 supports PHP 8.4 and newer only; 5.13.3 is the last release for PHP 8.3.
source_for pdo_sqlsrv pdo_sqlsrv-5.13.3 198a7b37da0658d36a93d158a0ec179b137b3a4d241c90a6650ae9ee8f91ec4a .
source_for sqlsrv sqlsrv-5.13.3 1c3092ca793bb67002ca022c412aacabb79a3297ee7005e3b7cc91b1e7166d22 .
else
# Since 5.14.0 the drivers are published through PIE and GitHub releases, not PECL.
# Use the exact release archives without GitHub API discovery: anonymous PIE
# lookups can fail authentication while resolving these packaged sources.
release_for pdo_sqlsrv https://github.com/microsoft/msphpsql/releases/download/v5.14.0/pdo_sqlsrv-v5.14.0.tgz \
e6493a697bdc9da8e375c6f7b97903b72c3916093636016db8ddbf9761332566
release_for sqlsrv https://github.com/microsoft/msphpsql/releases/download/v5.14.0/sqlsrv-v5.14.0.tgz \
7397647a443e0f6b36ca26cee21bd55d690318641939f8b32c6f51dae0d60d20
fi

if [[ "${php_minor}" != 8.2 && "${php_minor}" != 8.3 ]]; then
Expand Down
4 changes: 2 additions & 2 deletions 8/tests/extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
'mongodb' => '2.5.7',
'oauth' => '2.0.10',
'opentelemetry' => '1.5.0',
'pdo_sqlsrv' => PHP_VERSION_ID < 80300 ? '5.12.0' : '5.13.3',
'pdo_sqlsrv' => PHP_VERSION_ID < 80300 ? '5.12.0' : (PHP_VERSION_ID < 80400 ? '5.13.3' : '5.14.0'),
'pcov' => '1.0.12',
'protobuf' => '5.36.2',
'rdkafka' => '6.0.5',
'redis' => '6.3.0',
'sqlsrv' => PHP_VERSION_ID < 80300 ? '5.12.0' : '5.13.3',
'sqlsrv' => PHP_VERSION_ID < 80300 ? '5.12.0' : (PHP_VERSION_ID < 80400 ? '5.13.3' : '5.14.0'),
'smbclient' => '1.1.2',
'uploadprogress' => '2.0.2',
'uuid' => '1.3.0',
Expand Down
2 changes: 2 additions & 0 deletions 8/tests/php_modules/8.6
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pdo_sqlsrv
pgsql
Phar
posix
Expand All @@ -48,6 +49,7 @@ sockets
sodium
SPL
sqlite3
sqlsrv
standard
sysvmsg
sysvsem
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,13 @@ recognized by `PHP_EXTENSIONS_DISABLE`.

The build-only `8/install-extensions.sh` preserves extension versions and configure
options. gRPC follows the latest stable release compatible with the PHP version at
build time; its version is intentionally unpinned. Packages without a usable PIE release use checksum-verified release archives
from `pecl.php.net` without invoking the PECL client. Update each archive's version
and SHA-256 together. PHP 8.2 retains SQL Server drivers 5.12.0; newer PHP versions
use Microsoft's PIE packages. IMAP remains bundled on PHP 8.2/8.3 and is built from
a release archive on PHP 8.4/8.5.
build time; its version is intentionally unpinned. Packages without a usable PIE
release use checksum-verified release archives from `pecl.php.net` without invoking
the PECL client. Update each archive's version and SHA-256 together. PHP 8.2 retains
SQL Server drivers 5.12.0 and PHP 8.3 retains 5.13.3, the last releases for those
versions; PHP 8.4 and newer use 5.14.0 from Microsoft's GitHub release archives.
IMAP remains bundled on PHP 8.2/8.3 and is built from a release archive on PHP
8.4/8.5.

PHP 8.6 images ship without extensions that have no release supporting PHP 8.6 yet; they are marked `-` below and tracked in [#274](https://github.com/wodby/php/issues/274).

Expand Down Expand Up @@ -397,7 +399,7 @@ PHP 8.6 images ship without extensions that have no release supporting PHP 8.6 y
| pdo_mysql | | | | | |
| pdo_pgsql | | | | | |
| pdo_sqlite | | | | | |
| [pdo_sqlsrv] | - | 5.13.3 | 5.13.3 | 5.13.3 | 5.12.0 |
| [pdo_sqlsrv] | 5.14.0 | 5.14.0 | 5.14.0 | 5.13.3 | 5.12.0 |
| pgsql | | | | | |
| Phar | | | | | |
| posix | | | | | |
Expand All @@ -415,7 +417,7 @@ PHP 8.6 images ship without extensions that have no release supporting PHP 8.6 y
| SPL | | | | | |
| [spx] | - | 0.4.22 | 0.4.22 | 0.4.22 | 0.4.22 |
| sqlite3 | | | | | |
| [sqlsrv] | - | 5.13.3 | 5.13.3 | 5.13.3 | 5.12.0 |
| [sqlsrv] | 5.14.0 | 5.14.0 | 5.14.0 | 5.13.3 | 5.12.0 |
| standard | | | | | |
| sysvmsg | | | | | |
| sysvsem | | | | | |
Expand Down
Loading