diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30eddf0..d58eb60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,7 @@ jobs: - "3.23" php: - "8.4" + - "8.6" runs-on: ${{ matrix.build_image }} steps: - name: ↙️ Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7caf066..800c8d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,7 @@ jobs: - "8.3" - "8.4" - "8.5" + - "8.6" runs-on: ${{ matrix.build_image }} steps: - name: ↙️ Checkout diff --git a/README.md b/README.md index dfeea57..6e8644a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,26 @@ RUN apk add --no-cache curl ca-certificates && \ echo "https://packages.skpr.io/php-alpine/${ALPINE_VERSION}/php${PHP_VERSION}" >> /etc/apk/repositories ``` +## PHP 8.6 + +PHP 8.6 currently ships the base PHP packages only (`php8.6` and its bundled extensions, eg. `php8.6-fpm`, `php8.6-intl`, `php8.6-pdo_mysql`). + +None of our extensions build against PHP 8.6.0 yet. Most still use compatibility macros that PHP 8.6.0 removed (`zval_dtor`, `zval_is_true`, `XtOffsetOf`, etc.). +We are waiting on the following before adding each one back: + +| Extension | Current release | Waiting on | +|-----------|-----------------|------------| +| apcu | 5.1.28 | A release with the fix already on master. 5.1.29 was tagged then reverted ([krakjoe/apcu#634](https://github.com/krakjoe/apcu/issues/634)). | +| compass | 1.1.0 | Our own extension. Needs a release with a phper version that compiles against the PHP 8.6.0 headers ([skpr/compass-extension](https://github.com/skpr/compass-extension)). | +| grpc | 1.85.4 | Not built for PHP 8.5 either. Revisit after the other extensions. | +| imagick | 3.8.1 | The fix to be merged ([Imagick/imagick#768](https://github.com/Imagick/imagick/pull/768)) and released ([Imagick/imagick#804](https://github.com/Imagick/imagick/issues/804)). | +| memcached | 3.4.0 | A release with the fix already on master ([php-memcached-dev/php-memcached#586](https://github.com/php-memcached-dev/php-memcached/issues/586)). | +| redis | 6.3.0 | The fix to be merged ([phpredis/phpredis#2831](https://github.com/phpredis/phpredis/pull/2831)) and released. | +| spx | 0.4.22 | A release with PHP 8.6 support, merged on master in [NoiseByNorthwest/php-spx#353](https://github.com/NoiseByNorthwest/php-spx/pull/353). | +| xdebug | 3.5.3 | A release with PHP 8.6 support. 3.5.x refuses to build against PHP 8.6, master already allows it ([xdebug/xdebug](https://github.com/xdebug/xdebug)). | + +Skipped extensions are listed in `build/entrypoint`. To add one back, create `packages/php8.6-` from its `packages/php8.5-` counterpart, bump it to a release with PHP 8.6 support, mirror the tarball and remove it from the exclude list. + ## Local Development **Generate Keys** diff --git a/build/Dockerfile b/build/Dockerfile index 15198ca..b03403c 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -11,8 +11,8 @@ FROM alpine:${ALPINE_VERSION} # (https://serverfault.com/questions/1017932/php-fpm-notice-the-log-buffer-is-full-1024-the-access-log-request-has-been). # It only has an effect on PHP 8.2 and 8.3 out of the box: 8.4 dropped the #ifdef it # relies on (php/php-src#5634), which packages/php8.4/fpm-log-buffer.patch restores, -# and 8.5 replaced the buffer entirely with the runtime "log_limit" setting, which -# packages/php8.5/APKBUILD pins to 8192 in php-fpm.conf. +# and 8.5+ replaced the buffer entirely with the runtime "log_limit" setting, which +# packages/php8.5/APKBUILD and packages/php8.6/APKBUILD pin to 8192 in php-fpm.conf. # -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -DMAX_LINE_LENGTH=8192 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ENV PHP_CPPFLAGS="$PHP_CFLAGS" diff --git a/build/entrypoint b/build/entrypoint index 0bc2fec..7ff4902 100644 --- a/build/entrypoint +++ b/build/entrypoint @@ -47,6 +47,29 @@ if [ "$PHP_VERSION" == "8.5" ]; then done fi +# Temporary workaround for unavailable packages for PHP 8.6. These have no +# packages/php8.6-* directory until upstream supports PHP 8.6. +# Xdebug 3.5.x refuses to configure against PHP >= 8.6.0, and the current +# apcu, imagick, memcached and redis releases still use compatibility macros +# that PHP 8.6.0 removed (zval_dtor, XtOffsetOf, etc.). Compass's phper +# bindings don't compile against the PHP 8.6.0 headers yet, and spx 0.4.22 +# hard-errors on anything newer than PHP 8.5. +if [ "$PHP_VERSION" == "8.6" ]; then + exclude_packages=( + "php${PHP_VERSION}-apcu" + "php${PHP_VERSION}-compass" + "php${PHP_VERSION}-grpc" + "php${PHP_VERSION}-imagick" + "php${PHP_VERSION}-memcached" + "php${PHP_VERSION}-redis" + "php${PHP_VERSION}-spx" + "php${PHP_VERSION}-xdebug" + ) + for i in "${exclude_packages[@]}"; do + packages=(${packages[@]//*$i*}) + done +fi + for package in "${packages[@]}"; do echo "Building Package: ${package}" diff --git a/packages/php8.6/APKBUILD b/packages/php8.6/APKBUILD new file mode 100644 index 0000000..14ac420 --- /dev/null +++ b/packages/php8.6/APKBUILD @@ -0,0 +1,410 @@ +# Maintainer: Nick Schuch + +pkgname=php8.6 +pkgrel=1 +pkgver=8.6.0 +pkgdesc="The PHP language runtime engine - 8th branch" +url="http://www.php.net/" +arch="all" +license="PHP-3" +options="" +depends="$pkgname-common>=8.6.0 $pkgname-common<8.7.0" +makedepends=" + autoconf + argon2-dev + aspell-dev + bison + bzip2-dev + curl-dev + db-dev + enchant2-dev + expat-dev + freetype-dev + freetds-dev + gdbm-dev + gsoap-dev + gettext-dev + gnu-libiconv-dev + gmp-dev + krb5-dev + icu-dev + libxml2-dev + libxslt-dev + libzip-dev + libical-dev + libsodium-dev + libxpm-dev + libpng-dev + libwebp-dev + libjpeg-turbo-dev + libedit-dev + libgcrypt-dev + libgpg-error-dev gd-dev + mariadb-dev + net-snmp-dev + openssl-dev + openldap-dev + oniguruma-dev + paxmark + pcre-dev + pcre2-dev + postgresql-dev + re2c + recode-dev + sqlite-dev + tidyhtml-dev + unixodbc-dev + zlib-dev + " + +source="php-$pkgver.tar.bz2::https://packages.skpr.io/distributions/php-$pkgver.tar.bz2 + install-pear.patch + " +builddir="$srcdir/php-$pkgver" + +_exts=" + bcmath + bz2 + calendar + ctype + curl + dba + dom + enchant + exif + ftp + fileinfo + gd + gettext + gmp + intl + ldap + mbstring + mysqli + mysqlnd + odbc + openssl + pcntl + pdo + pdo_dblib + pdo_mysql + pdo_odbc + pdo_pgsql + pdo_sqlite + pgsql + phar + posix + session + simplexml + shmop + snmp + soap + sockets + sodium + sqlite3 + sysvmsg + sysvsem + sysvshm + tidy + tokenizer + xml + xmlreader + xmlwriter + xsl + zip + zlib + " + +subpackages=" + $pkgname-dev + $pkgname-doc + $pkgname-fpm + $pkgname-pear::noarch + " +for _ext in $_exts; do + case "$_ext" in + *:*) subpackages="$subpackages $pkgname-$_ext";; + *) subpackages="$subpackages $pkgname-$_ext:_package_ext";; + esac +done +subpackages="$subpackages $pkgname-common::noarch" + +_apiver="20261112" + +prepare() { + # make sure musl's iconv doesn't get used (https://www.php.net/manual/en/intro.iconv.php) + sudo rm -vf /usr/include/iconv.h + # PHP < 8 doesn't know to look deeper for GNU libiconv: https://github.com/php/php-src/commit/b480e6841ecd5317faa136647a2b8253a4c2d0df + sudo ln -sv /usr/include/gnu-libiconv/*.h /usr/include/ + + cd "$builddir" + + default_prepare || return 1 + + local vapi=$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h) + if [ "$vapi" != "$_apiver" ]; then + error "Upstreram API version is now $vapi. Expecting $_apiver" + return 1 + fi + + autoconf +} + +build() { + cd "$builddir" + + export EXTENSION_DIR=/usr/lib/php/modules + + export CFLAGS="$PHP_CFLAGS" + export CPPFLAGS="$PHP_CPPFLAGS" + export LDFLAGS="$PHP_LDFLAGS" + + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --libdir=/usr/lib/php \ + --datadir=/usr/share/php \ + --sysconfdir=/etc/php \ + --localstatedir=/var \ + --with-avif \ + --with-layout=GNU \ + --enable-pic \ + --with-password-argon2 \ + --with-pear=/usr/share/php \ + --with-php-config=/usr/bin/php-config \ + --with-config-file-path=/etc/php \ + --with-config-file-scan-dir=/etc/php/conf.d \ + --disable-short-tags \ + --with-openssl=shared --with-kerberos --with-system-ciphers \ + --with-external-pcre=/usr \ + --with-zlib=shared \ + --enable-bcmath=shared \ + --with-bz2=shared \ + --enable-calendar=shared \ + --enable-ctype=shared \ + --with-curl=shared \ + --enable-dba=shared --with-gdbm --with-db4 \ + --enable-dom=shared \ + --with-enchant=shared \ + --enable-exif=shared \ + --enable-ftp=shared \ + --enable-gd=shared --with-webp=shared --with-jpeg=shared --with-xpm=shared --with-external-gd \ + --with-freetype=shared --enable-gd-native-ttf --enable-gd-jis-conv \ + --with-gettext=shared \ + --with-gmp=shared \ + --with-sodium=shared \ + --with-iconv=/usr \ + --enable-intl=shared \ + --enable-json=shared \ + --with-libxml=shared --with-expat=shared \ + --with-ldap=shared --with-ldap-sasl \ + --enable-mbstring=shared --enable-mbregex \ + --with-sqlite3=shared,/usr --with-pdo-sqlite=shared,/usr \ + --with-pdo-dblib=shared \ + --with-mysqli=shared,mysqlnd \ + --enable-mysqlnd=shared --with-pdo-mysql=shared,mysqlnd --with-mysql-sock=/run/mysqld/mysqld.sock \ + --with-pgsql=shared --with-pdo-pgsql=shared \ + --with-unixODBC=shared,/usr -with-pdo-odbc=shared,unixODBC,/usr \ + --with-dbmaker=shared \ + --enable-fileinfo=shared \ + --enable-opcache=shared \ + --enable-pdo=shared \ + --enable-pcntl=shared \ + --enable-posix=shared \ + --enable-phar=shared \ + --without-readline \ + --with-libedit \ + --enable-session=shared \ + --enable-shmop=shared \ + --with-snmp=shared \ + --enable-soap=shared \ + --enable-sockets=shared \ + --enable-sysvmsg=shared \ + --enable-sysvsem=shared \ + --enable-sysvshm=shared \ + --enable-tokenizer=shared \ + --with-tidy=shared \ + --enable-xml=shared \ + --enable-xmlreader=shared \ + --enable-xmlwriter=shared \ + --enable-simplexml=shared \ + --with-xmlrpc=shared \ + --with-xsl=shared \ + --with-zip=shared \ + --disable-phpdbg \ + --enable-fpm $@ || return 1 + sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183 (from main/php) + + make || return 1 +} + +package() { + cd "$builddir" + + make -j1 INSTALL_ROOT="$pkgdir" install || return 1 + + install -Dm644 php.ini-production "$pkgdir"/etc/php/php.ini || return 1 + + # patch pecl problem with shared xml extension + sed -i 's/\(-C *\)[^ ]*/\1/' "$pkgdir"/usr/bin/pecl + + paxmark -m "$pkgdir"/usr/bin/php + + find "$pkgdir" -name '.*' | xargs rm -rf || return 1 + rmdir "$pkgdir"/var/run +} + +dev() { + default_dev + + depends="$depends $pkgname>=8.6.0 $pkgname<8.7.0 $pkgname-pear>=8.6.0 $pkgname-pear<8.7.0" + provides="php-dev=$pkgver-r$pkgrel php8-dev=$pkgver-r$pkgrel" + replaces="php-dev php8-dev" + + mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib/php + + echo "pkgdir = $pkgdir" + echo "subpkgdir = $subpkgdir" + + mv "$subpkgdir"/usr/bin/php-config "$pkgdir"/usr/bin/peardev "$subpkgdir"/usr/bin/ || return 1 + mv "$pkgdir"/usr/lib/php/build "$subpkgdir"/usr/lib/php/ +} + +doc() { + default_doc + + provides="php-doc=$pkgver-r$pkgrel php8-doc=$pkgver-r$pkgrel" + replaces="php-doc php8-doc" + + mkdir -p "$subpkgdir"/usr/share/doc/php + + local file + for file in CODING_STANDARDS* EXTENSIONS LICENSE NEWS README* UPGRADING*; do + cp "$builddir"/$file "$subpkgdir"/usr/share/doc/php/ || return 1 + done +} + +fpm() { + pkgdesc="PHP FastCGI Process Manager" + + depends="$pkgname-common>=8.6.0 $pkgname-common<8.7.0" + provides="php-fpm=$pkgver-r$pkgrel php8-fpm=$pkgver-r$pkgrel" + replaces="php-fpm php8-fpm" + + mv "$pkgdir"/var "$subpkgdir"/ || return 1 + + mkdir -p "$subpkgdir"/etc/php \ + "$subpkgdir"/usr \ + "$subpkgdir"/var/lib \ + "$subpkgdir"/var/log/php + + mv "$pkgdir"/usr/share/php/fpm "$subpkgdir"/var/lib/php/ || return 1 + mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/ || return 1 + mv "$pkgdir"/etc/php/php-fpm* "$subpkgdir"/etc/php/ || return 1 + + local file; for file in php-fpm.conf php-fpm.d/www.conf; do + mv "$subpkgdir"/etc/php/$file.default \ + "$subpkgdir"/etc/php/$file || return 1 + done + + # PHP 8.5+ rewrote the FPM access log on top of zlog streams, so the line + # length is now capped by the global "log_limit" setting (default 1024) + # rather than the -DMAX_LINE_LENGTH build flag we use on 8.2 - 8.4. + # Keep the same 8192 byte ceiling we have had on the older branches. + sed -i -e 's|^;log_limit = .*|log_limit = 8192|' \ + "$subpkgdir"/etc/php/php-fpm.conf || return 1 + grep -q '^log_limit = 8192$' "$subpkgdir"/etc/php/php-fpm.conf || { + error "failed to set log_limit in php-fpm.conf" + return 1 + } +} + +pear() { + pkgdesc="PHP Extension and Application Repository" + + depends="$pkgname>=8.6.0 $pkgname<8.7.0 $pkgname-xml>=8.6.0 $pkgname-xml<8.7.0" + provides="php-pear=$pkgver-r$pkgrel php8-pear=$pkgver-r$pkgrel" + replaces="php-pear php8-pear" + + mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/php + + local file; for file in phpize pecl pear; do + mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/ + done + + mv "$pkgdir"/etc/php/pear.conf "$subpkgdir"/etc/php/ || return 1 + mv "$pkgdir"/usr/share "$subpkgdir"/usr/ +} + +common() { + pkgdesc="$pkgdesc (common config)" + + depends="" + provides="php-common=$pkgver-r$pkgrel php8-common=$pkgver-r$pkgrel" + replaces="php-common php8-common" + + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1 + mv "$pkgdir"/etc "$subpkgdir"/ || return 1 + + mkdir "$subpkgdir"/etc/php/conf.d +} + +phar() { + depends="$pkgname>=8.6.0 $pkgname<8.7.0" + provides="php-phar=$pkgver-r$pkgrel php8-phar=$pkgver-r$pkgrel" + replaces="php-phar php8-phar" + + _package_ext || return 1 + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/ +} + +depends_dom="$pkgname-xml>=8.6.0 $pkgname-xml<8.7.0" +depends_mysqlnd="$pkgname-openssl>=8.6.0 $pkgname-openssl<8.7.0" +depends_mysqli="$pkgname-mysqlnd>=8.6.0 $pkgname-mysqlnd<8.7.0" +depends_pdo_mysql="$pkgname-mysqlnd>=8.6.0 $pkgname-mysqlnd<8.7.0" +depends_soap="$pkgname-xml>=8.6.0 $pkgname-xml<8.7.0" +depends_xmlreader="$pkgname-dom>=8.6.0 $pkgname-dom<8.7.0" +depends_xmlrpc="$pkgname-xml>=8.6.0 $pkgname-xml<8.7.0" +depends_xsl="$pkgname-dom>=8.6.0 $pkgname-dom<8.7.0" + +_package_ext() { + local extname="${subpkgname#$pkgname-}" + local extdepends="$(eval "echo \$depends_$extname")" + + pkgdesc="PHP8 extension: $extname" + + depends="$depends $extdepends" + provides="php-$extname=$pkgver-r$pkgrel php8-$extname=$pkgver-r$pkgrel" + replaces="php-$extname php8-$extname" + + case "$extname" in + pdo_*) depends="$depends $pkgname-pdo>=8.6.0 $pkgname-pdo<8.7.0" + esac + + # extension dependencies and loading order + local elo=00 + [ -z "$extdepends" ] || elo=01 + if [ "$extname" = "pdo_mysql" ]; then + elo=20 + fi + if [ "$extname" = "mysqli" ]; then + elo=20 + fi + # extension prefix + local prefix= + [ "$extname" != "opcache" ] || prefix="zend_" + + mkdir -p "$subpkgdir"/usr/lib/php/modules "$subpkgdir"/etc/php/conf.d + mv "$pkgdir"/usr/lib/php/modules/$extname.so "$subpkgdir"/usr/lib/php/modules/ || return 1 + + echo "${prefix}extension=$extname" \ + > "$subpkgdir"/etc/php/conf.d/${elo}_${extname}.ini +} + +sha512sums=" +fb2dfbd34ff7de3d5bb8a979617f547d2483331b81ec9662054272cc5faf653fb81eaba40f80146f3bdfa6a663a7a97234836e3c3fabcec2667abc039cfd1e34 php-8.6.0.tar.bz2 +4b3ec005059a74c9f2019d8ba074cf419978e6390dd7179422848b00dd358392ce377619caed7800148689c4b6dff110cce4409cc6b8644248a6ca9b6fe2b7a6 install-pear.patch +" diff --git a/packages/php8.6/install-pear.patch b/packages/php8.6/install-pear.patch new file mode 100644 index 0000000..4011876 --- /dev/null +++ b/packages/php8.6/install-pear.patch @@ -0,0 +1,14 @@ +--- ./pear/Makefile.frag.orig 2025-11-21 10:36:59.093526495 +1100 ++++ ./pear/Makefile.frag 2025-11-21 10:38:53.394461547 +1100 +@@ -1,7 +1,10 @@ + peardir=$(PEAR_INSTALLDIR) + ++# help the built php to find xml extension so we can install pear ++PEAR_INSTALL_XML_FLAGS = -d extension_dir="$(top_builddir)/modules" -d extension=xml.so -d extension=phar.so ++ + # Skip all php.ini files altogether +-PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 ++PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 $(PEAR_INSTALL_XML_FLAGS) + + WGET = `which wget 2>/dev/null` + FETCH = `which fetch 2>/dev/null`