diff --git a/8/install-extensions.sh b/8/install-extensions.sh index 8069a0bb..bfd57986 100644 --- a/8/install-extensions.sh +++ b/8/install-extensions.sh @@ -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. @@ -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 @@ -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 @@ -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 diff --git a/8/tests/extensions.php b/8/tests/extensions.php index f1afef5f..289ea609 100644 --- a/8/tests/extensions.php +++ b/8/tests/extensions.php @@ -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', diff --git a/8/tests/php_modules/8.6 b/8/tests/php_modules/8.6 index b4f1b0b8..be3137de 100644 --- a/8/tests/php_modules/8.6 +++ b/8/tests/php_modules/8.6 @@ -35,6 +35,7 @@ PDO pdo_mysql pdo_pgsql pdo_sqlite +pdo_sqlsrv pgsql Phar posix @@ -48,6 +49,7 @@ sockets sodium SPL sqlite3 +sqlsrv standard sysvmsg sysvsem diff --git a/README.md b/README.md index 71e2c659..71b132df 100644 --- a/README.md +++ b/README.md @@ -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). @@ -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 | | | | | | @@ -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 | | | | | |