# Contributor: Valery Kartel # Contributor: Jakub Jirutka # Maintainer: Andy Postnikov # Bundled libraries # # Name | License | Location | State # ----------+---------------------+------------------------+--------- # bcmath | LGPL-2.1-or-later | ext/bcmath/libbcmath | used # date | MIT | ext/date/lib | used # fileinfo | BSD-2-Clause | ext/fileinfo/libmagic | used # gd | BSD | ext/gd/libgd | used # hash | CC0-1.0 | ext/hash/sha3 | used # xxHash | BSD-2-Clause | ext/hash/xxhash | used # lexbor | Apache-2.0 | ext/lexbor/lexbor | used # libmbfl | LGPL-2.1-only | ext/mbstring/libmbfl | used # pcre2 | BSD-3-Clause | ext/pcre/pcre2lib | not used # uriparser | BSD-3-Clause | ext/uri/uriparser | used # Static extensions # # Name | Reason # ----------+-------------------------------------------- # zlib | https://bugs.alpinelinux.org/issues/8299 # json | https://wiki.php.net/rfc/always_enable_json maintainer="Andy Postnikov " pkgname=php85 pkgver=8.5.13 pkgrel=0 _apiver=20250925 _suffix=${pkgname#php} # Is this package the default (latest) PHP version? _default_php="yes" provides="$pkgname-cli php-cli php" # for backward compatibility provider_priority=100 pkgdesc="The PHP$_suffix language runtime engine" url="https://www.php.net/" arch="all" license="PHP-3.01 BSD-3-Clause LGPL-2.0-or-later MIT Zend-2.0 Apache-2.0" depends="$pkgname-common" depends_dev="$pkgname=$pkgver-r$pkgrel autoconf pcre2-dev re2c" # Most dependencies between extensions is auto-discovered (see _extension()). _depends_mysqlnd="$pkgname-openssl" _depends_pdo_mysql="$pkgname-pdo $pkgname-mysqlnd" _depends_phar="$pkgname" # openssl is actually transitive dependency here, but we need to because of # load index based on number of dependencies. _depends_mysqli="$pkgname-mysqlnd $pkgname-openssl" _clang_ver=22 makedepends=" $depends_dev acl-dev apache2 apache2-dev argon2-dev bison bzip2-dev clang$_clang_ver curl-dev enchant2-dev freetds-dev freetype-dev gdbm-dev gettext-dev gmp-dev icu-dev libavif-dev libedit-dev libical-dev libjpeg-turbo-dev libpng-dev libpq-dev lmdb-dev oniguruma-dev libsodium-dev libwebp-dev libxml2-dev libxpm-dev libxslt-dev libzip-dev net-snmp-dev openldap-dev sqlite-dev tidyhtml-dev unixodbc-dev zlib-dev " checkdepends="icu-data-full procps-ng lsof" subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-phpdbg $pkgname-apache2 $pkgname-embed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch " # RC releases #source="https://downloads.php.net/~pierrick/php-${pkgver}RC1.tar.xz #source="https://downloads.php.net/~edorian/php-${pkgver}RC1.tar.xz #source="https://downloads.php.net/~daniels/php-${pkgver}RC1.tar.xz # stable releases source="https://www.php.net/distributions/php-$pkgver.tar.xz $pkgname-fpm.initd $pkgname-fpm.logrotate $pkgname-module.conf disabled-tests.list disabled-tests.loongarch64.list disabled-tests.x86.list disabled-tests.ppc64le.list disabled-tests.s390x.list install-pear.patch includedir.patch sharedir.patch $pkgname-fpm-version-suffix.patch phpinfo-avif.patch fix-ini_info.patch " builddir="$srcdir/php-$pkgver" _libdir="/usr/lib/$pkgname" _extension_dir="$_libdir/modules" _extension_confd="/etc/$pkgname/conf.d" _extensions=" bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo ftp gd gettext gmp iconv intl ldap mbstring mysqli mysqlnd odbc openssl pcntl pdo pdo_dblib pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix session shmop simplexml snmp soap sodium sockets sqlite3 sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zip " for _ext in $_extensions; do case "$_ext" in phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; *) subpackages="$subpackages $pkgname-$_ext:_extension";; esac done subpackages="$subpackages $pkgname-common::noarch" subpackages="$subpackages $pkgname-litespeed" # secfixes: # 8.5.13-r0: # - CVE-2026-15353 GHSA-q23r-hr55-xmpg # - CVE-2026-115560 GHSA-658j-r8rw-q6mx # - CVE-2026-126714 GHSA-fm2m-fjf5-v3cp # - CVE-2026-127960 GHSA-mmf9-xm3v-hg2x # - CVE-2026-128064 GHSA-f6gg-rchx-xw8j # - CVE-2026-128090 GHSA-68fq-fh7h-f8gr # - CVE-2026-129289 GHSA-qc49-hpvq-g2w6 # - CVE-2026-129291 GHSA-jm4m-qfqx-967m # - CVE-2026-129292 GHSA-3mg3-cr28-46gc # - CVE-2026-129481 GHSA-g3vh-838c-65v7 # - CVE-2026-129496 GHSA-gr4f-wgx5-jpfv # - CVE-2026-129501 GHSA-x8r7-mg3g-74hg # - CVE-2026-129506 GHSA-4646-p932-gw34 # - CVE-2026-129538 GHSA-5j3f-64r7-f564 # 8.5.12-r0: # - CVE-2026-109618 GHSA-w8hw-w9fx-j79w # - CVE-2026-109619 GHSA-7875-c8px-7q5f # 8.5.11-r0: # - CVE-2025-1218 # - CVE-2025-14181 # - CVE-2026-6103 # - CVE-2026-91765 # - CVE-2026-91766 # - CVE-2026-91767 # - CVE-2026-91768 # - CVE-2026-91769 # - CVE-2026-92842 # - CVE-2026-93682 # 8.5.9-r0: # - CVE-2026-7260 # - CVE-2026-9672 # - CVE-2026-17543 # - CVE-2026-17544 # 8.5.8-r0: # - CVE-2026-14355 # 8.5.7-r0: # - CVE-2026-44927 # - CVE-2026-44928 # 8.5.6-r0: # - CVE-2026-6104 # - CVE-2026-6722 # - CVE-2026-6735 # - CVE-2026-7258 # - CVE-2026-7259 # - CVE-2026-7261 # - CVE-2026-7262 # - CVE-2026-7263 # - CVE-2026-7568 # - CVE-2026-29078 # - CVE-2026-29079 # - CVE-2026-42371 # 8.5.1-r0: # - CVE-2025-14177 # - CVE-2025-14178 # - CVE-2025-14180 prepare() { default_prepare local vapi=$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h) if [ "$vapi" != "$_apiver" ]; then error "Upstream API version is now $vapi. Expecting $_apiver" error "After updating _apiver, all 3rd-party extensions must be rebuilt." return 1 fi # https://bugs.php.net/63362 - Not needed but installed headers. # Drop some Windows specific headers to avoid installation, # before build to ensure they are really not needed. rm -f TSRM/tsrm_win32.h \ TSRM/tsrm_config.w32.h \ Zend/zend_config.w32.h \ ext/mysqlnd/config-win.h \ ext/standard/winver.h # Fix some bogus permissions. find . -name '*.[ch]' -exec chmod 644 {} \; # Remove failing tests includng arch specific ones. local tests="disabled-tests.list disabled-tests.$CARCH.list" local file; for file in $tests; do [ -f "$srcdir"/$file ] && \ sed -n '/^[^#]/p' "$srcdir"/$file | while read -r item; do rm -r $item # do it in this way to apply globbing... done done autoconf } # All shared-extension flags. Pass-1 (apache2 SAPI) intentionally omits these; # pass-2 includes them via $_shared_extensions word-splitting. # Notes: # * gd-jis-conv breaks any non-latin font rendering (vakartel). # * libxml cannot be built as shared. _shared_extensions=" --enable-bcmath=shared --with-bz2=shared --enable-calendar=shared --enable-ctype=shared --with-curl=shared --enable-dba=shared --with-gdbm --with-lmdb --enable-dom=shared --with-enchant=shared --enable-exif=shared --with-ffi=shared --enable-fileinfo=shared --enable-ftp=shared --enable-gd=shared --with-avif --with-freetype --with-jpeg --with-webp --with-xpm --disable-gd-jis-conv --with-gettext=shared --with-gmp=shared --with-iconv=shared --enable-intl=shared --with-ldap=shared --with-ldap-sasl --with-libedit --enable-mbstring=shared --with-mysqli=shared --with-mysql-sock=/run/mysqld/mysqld.sock --enable-mysqlnd=shared --with-openssl=shared --with-system-ciphers --with-openssl-argon2 --with-password-argon2 --enable-pcntl=shared --enable-pdo=shared --with-pdo-dblib=shared,/usr --with-pdo-mysql=shared,mysqlnd --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-pgsql=shared --with-pdo-sqlite=shared --with-pgsql=shared --enable-phar=shared --enable-posix=shared --without-readline --enable-session=shared --enable-shmop=shared --enable-simplexml=shared --with-snmp=shared --enable-soap=shared --with-sodium=shared --enable-sockets=shared --with-sqlite3=shared --enable-sysvmsg=shared --enable-sysvsem=shared --enable-sysvshm=shared --with-tidy=shared --enable-tokenizer=shared --with-unixODBC=shared,/usr --enable-xml=shared --enable-xmlreader=shared --enable-xmlwriter=shared --with-xsl=shared --with-zip=shared --enable-zend-test=shared " # Configure + make wrapper. Caller passes variant-specific flags via "$@". # -O2 optimize for apps usage (andypost) _build() { export CFLAGS="${CFLAGS/-Os/-O2}" export CXXFLAGS="${CXXFLAGS/-Os/-O2}" case "$CARCH" in arm*|aarch64|riscv64|loongarch64) export CFLAGS="${CFLAGS/-fstack-clash-protection}" export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection}" ;; esac export CC=clang-$_clang_ver export CXX=clang++-$_clang_ver local without_pcre_jit [ "$CARCH" = "s390x" ] && without_pcre_jit="--without-pcre-jit" PHP_BUILD_PROVIDER="Alpine Linux aports" \ EXTENSION_DIR=$_extension_dir ./configure \ "$@" \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --program-suffix=$_suffix \ --libdir=$_libdir \ --datadir=/usr/share/$pkgname \ --sysconfdir=/etc/$pkgname \ --localstatedir=/var \ --with-layout=GNU \ --with-pic \ --with-config-file-path=/etc/$pkgname \ --with-config-file-scan-dir=$_extension_confd \ --disable-rpath \ --disable-short-tags \ --with-libxml \ --with-zlib \ --with-external-pcre $without_pcre_jit \ --enable-filter make } build() { # https://bugs.php.net/bug.php?id=52419 — apache2 SAPI can't share a make # invocation with CLI/FPM, hence two passes. Pass-1 is trimmed to core # (--disable-all) so the 50+ shared extensions aren't built twice; pass-2 # rebuilds them once after `make distclean` clears the autoconf cache. _build --disable-all --disable-phpdbg --disable-cli --with-apxs2 # Stash apache2 module outside $builddir; distclean will wipe sapi/. install -Dm755 libs/libphp.so "$srcdir"/mod_php$_suffix.so make distclean local enable_litespeed [ -z ${subpackages##*-litespeed*} ] && enable_litespeed=--enable-litespeed _build $_shared_extensions \ --enable-phpdbg \ --with-pear=/usr/share/$pkgname \ --enable-fpm \ --with-fpm-acl \ $enable_litespeed \ --enable-embed # Restore apache2 module to where package() expects it. install -Dm755 "$srcdir"/mod_php$_suffix.so \ sapi/apache2handler/mod_php$_suffix.so } check() { # PHP is so stupid that it's not able to resolve dependencies # between extensions and load them in correct order, so we must # help it... local php_modules=$(_extensions_by_load_order \ | xargs -n 1 printf "'$builddir/modules/%s.la' ") sed -i "/^PHP_TEST_SHARED_EXTENSIONS/,/extension=/ \ s|in \$(PHP_MODULES)\"*|in $php_modules|" Makefile # XXX: Few tests fail on the named platforms. # Ignore it for now and continue build even on test failures. local allow_fail='no' case "$CARCH" in no ) allow_fail='yes' esac TESTS="${TESTS:- --show-diff }" NO_INTERACTION=1 REPORT_EXIT_STATUS=1 \ SKIP_SLOW_TESTS=1 SKIP_ONLINE_TESTS=1 TEST_TIMEOUT=10 \ SKIP_PERF_SENSITIVE=1 \ TZ='' LANG='' LC_ALL='' TEST_FPM_EXTENSION_DIR=modules \ TRAVIS=true SKIP_IO_CAPTURE_TESTS=1 \ make test || [ "$allow_fail" = yes ] echo 'NOTE: We have skipped quite a lot tests, see disabled-tests.list.' } package() { make -j1 INSTALL_ROOT="$pkgdir" install # zend_test is needed at check() time but not shipped to end users. rm "$pkgdir"/usr/lib/php$_suffix/modules/zend_test.so install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini local file; for file in pear peardev pecl; do sed -i -e "s|/usr/bin/php|/usr/bin/php$_suffix|g" \ -e "s|PHP=php|PHP=php$_suffix|" \ "$pkgdir"/usr/bin/$file done find "$pkgdir" -name '.*' -print0 | xargs -0 rm -rf rmdir "$pkgdir"/var/run if [ "$_default_php" = yes ]; then ln -s php$_suffix "$pkgdir"/usr/bin/php fi install -D -m 755 sapi/apache2handler/mod_php$_suffix.so \ "$pkgdir"/usr/lib/apache2/mod_php$_suffix.so install -D -m 644 "$srcdir"/php$_suffix-module.conf \ "$pkgdir"/etc/apache2/conf.d/php$_suffix-module.conf } dev() { default_dev replaces="php-dev" amove \ usr/bin/php-config$_suffix \ usr/bin/phpize$_suffix \ $_libdir/build if [ "$_default_php" = yes ]; then ln -s phpize$_suffix "$subpkgdir"/usr/bin/phpize ln -s php-config$_suffix "$subpkgdir"/usr/bin/php-config fi } doc() { default_doc cd "$builddir" mkdir -p "$subpkgdir"/usr/share/doc/$pkgname cp CODING_STANDARDS.md EXTENSIONS LICENSE NEWS \ README* UPGRADING* \ "$subpkgdir"/usr/share/doc/$pkgname/ } apache2() { pkgdesc="PHP$_suffix Module for Apache2" depends="$depends apache2" provides="php-apache2" amove usr/lib/apache2/mod_php$_suffix.so amove etc/apache2/conf.d/php$_suffix-module.conf } phpdbg() { pkgdesc="Interactive PHP$_suffix debugger" provides="php-phpdbg" amove usr/bin/phpdbg$_suffix if [ "$_default_php" = yes ]; then ln -s phpdbg$_suffix "$subpkgdir"/usr/bin/phpdbg fi } embed() { pkgdesc="PHP$_suffix Embedded Library" provides="php-embed" amove usr/lib/php$_suffix/libphp.so } litespeed() { pkgdesc="PHP$_suffix LiteSpeed SAPI" provides="php-lightspeed" amove usr/bin/lsphp$_suffix if [ "$_default_php" = yes ]; then ln -s lsphp$_suffix "$subpkgdir"/usr/bin/lsphp fi } cgi() { pkgdesc="PHP$_suffix Common Gateway Interface" provides="php-cgi" amove usr/bin/php-cgi$_suffix if [ "$_default_php" = yes ]; then ln -s php-cgi$_suffix "$subpkgdir"/usr/bin/php-cgi fi } fpm() { pkgdesc="PHP$_suffix FastCGI Process Manager" provides="php-fpm" amove etc/$pkgname/php-fpm* usr/sbin var amove usr/share/$pkgname/fpm local file; for file in php-fpm.conf php-fpm.d/www.conf; do mv "$subpkgdir"/etc/$pkgname/$file.default \ "$subpkgdir"/etc/$pkgname/$file done install -D -m 755 "$srcdir"/$pkgname-fpm.initd \ "$subpkgdir"/etc/init.d/php-fpm$_suffix install -D -m 644 "$srcdir"/$pkgname-fpm.logrotate \ "$subpkgdir"/etc/logrotate.d/php-fpm$_suffix mkdir -p "$subpkgdir"/var/log/$pkgname } pear() { pkgdesc="PHP$_suffix Extension and Application Repository" depends="$pkgname $pkgname-xml" provides="php-pear" mkdir -p "$subpkgdir"/usr/bin local file; for file in pecl pear peardev; do mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/$file$_suffix if [ "$_default_php" = yes ]; then ln -s $file$_suffix "$subpkgdir"/usr/bin/$file fi done amove etc/$pkgname/pear.conf usr/share } common() { pkgdesc="$pkgdesc (common config)" provides="php-common $pkgname-zlib php-zlib $pkgname-json php-json" # for backward compatibility depends="" amove etc mkdir -p "$subpkgdir"/$_extension_confd "$subpkgdir"/$_extension_dir } phar() { _extension amove usr/bin/phar$_suffix.phar usr/bin/phar$_suffix if [ "$_default_php" = yes ]; then ln -s phar.phar$_suffix "$subpkgdir"/usr/bin/phar.phar ln -s phar.phar$_suffix "$subpkgdir"/usr/bin/phar fi } _extension() { local extname="${subpkgname#"$pkgname"-}" local extdepends="$(eval "echo \$_depends_$extname")" local extdesc="$(head -n1 "$builddir"/ext/$extname/CREDITS 2>/dev/null ||:)" pkgdesc="PHP$_suffix extension: ${extdesc:-$extname}" provides="php-$extname" : "${extdepends:=$(_resolve_extension_deps "$extname")}" depends="$depends $extdepends" local load_order=$(_extension_load_order "$extname") amove $_extension_dir/$extname.so mkdir -p "$subpkgdir"/$_extension_confd echo "extension=$extname" \ > "$subpkgdir"/$_extension_confd/"$(printf %02d $load_order)"_$extname.ini } # Resolves dependencies of the given extension name (without $pkgname- prefix) # on other extensions in $_extensions and prints them with $pkgname- prefix. _resolve_extension_deps() { local name="$1" # We use config.w32 just because it's more accurate than config.m4. local config="$builddir/ext/$name/config.w32" [ -f "$config" ] || return 0 sed -En "s/.*ADD_EXTENSION_DEP\('$name', ([^)]+)\).*/\1/p" "$config" \ | tr -d "'," | tr ' ' '\n' \ | sort -u \ | while read -r dep; do if echo "$_extensions" | grep -qw "$dep"; then echo "$pkgname-$dep" fi done } # Prints a load order (0-based integer) for the given extension name. Extension # with lower load order should be loaded before exts with higher load order. # It's based on number of dependencies of the extension (with exception for # "imap"), which is flawed, but simple and good enough for now. _extension_load_order() { local name="$1" local deps=$(eval "echo \$_depends_$name") case "$name" in # XXX: This must be loaded after recode, even though it does # not depend on it. So we must use this hack... *) echo "${deps:=$(_resolve_extension_deps $name)}" | wc -w;; esac } # Prints $_extensions sorted by load order and name. _extensions_by_load_order() { local deps list name for name in $_extensions; do list="$list $(_extension_load_order $name);$name" done printf '%s\n' $list | sort -t ';' -k 1 | sed -E 's/\d+;//' } sha512sums=" 00b5d0fc0a60fb071d060c0964fb3a9b833e1703d6c11aa765596f271cae1a9d8838ddc410af340e9bb62d125ff912e48a06ef630fdd15333c99d61ff50b61d5 php-8.5.13.tar.xz 7e08969f99a3ccaa0b6a9e5b91ce7dc8775978f096cc4eeffe378988fd52b61c78fc230b8e686521a458dabc1741bbf160039fa334cf5548281b5dec9820e1f6 php85-fpm.initd be2926ba61d0a7ef99178eb1c02e9e5a6698e9423f51b090f997e6ec056dbf8f87c2cd627dbc96eae86b1442c9c1b2df16ed406295023a29c02470ba284e4c69 php85-fpm.logrotate 57ef049fd8e659eed6b1e5895b8c8c04356873b80fdc7d2c66a7e750efdb27e8a3cd6c5bfa35ceae75d8f0885f1915611619260154f0ef2e6c60a27b7cc7909e php85-module.conf 6cab02f964a4f21bc0ed644c1db7aa6b37a7f2aaf24ee7385bb5a85f1aaf6b6a22b7a189f4c5aeb4a3abaf340d720d44c301511f317cb23066c0b490cdd70d21 disabled-tests.list a8b68c261e69f8feafa1bd8d9d2bd64c405884db716b30b7fa7f1d285fd938a5400bd57444148541040bb0d7410b21271d737303973af085458f3b4f8ce342aa disabled-tests.loongarch64.list 6d8f18822eeb61e1ef2d24551dde2dadaf7607f81364392351e6400da63e4d6fd9ea5f433c5ab7e4de78191d2bcebe3172d4a3024f0ee21b2e1e2c3cf4ad73cc disabled-tests.x86.list 6b655dc31ade992c395aaac826789e99ef6fdde62f7bc80e004264be565812a706476187d96e8c313a4d1fe8e595a0ad8a4c914d25a881090ceacf42ebd20e0e disabled-tests.ppc64le.list 4934def86c4d3817080ba152bc07d58ac6987f3070464e21c8e33e506184e760963cbf34db3aa66dbaceac1b2bf4daa49e60194b9b36290a946559a82e4590d6 disabled-tests.s390x.list d7bf35f424d8383e4bf6372d3ba8fca2ba1d1c435d1aea495a39fe79a5e17b31f96d373a33d777830412477be35a58be29eb852d7c6c012204e6004c4366fac2 install-pear.patch b4f802ec3e69190cfa6f2b00bfc9c7741e8300aba479728a00345cbde1c4f20b9ce46b08b861f8d4bb3c6fd6abf1e0f648783937ebef1fdc119fa93d2837a385 includedir.patch 61b007983c56dabbd1841255b209c0b9f2ddb83c8ade0dbd97a0ef59157c90bc785fe2b9f11e43e9d0db540fd96802dbca4adaeea72da8780f2a1a2d9895c37f sharedir.patch 73ae19d2b02873f560c4a25ed79a7436857fc405298a0b1e271638bf5dcc00f0bca403085517a59ab65739f03a12e77a838a22f90800ce8a8550c60ca6e7cf84 php85-fpm-version-suffix.patch 6eb4d3272b7030611c0654133d380c01d1cae9faae52e8b5972df2f867d02a7d0b023699cb838594908c25601856ad69adf086fe3927c4d81a36861cdd56fce2 phpinfo-avif.patch 1c33680e231bc2b69247b53b90d23c8e518b4f6bf94718b93848ea3c0ae8bbe2f691f8e69b7540e59b31c2edf5a12c78972815ef4ba7971f94bc64d2ee430bc9 fix-ini_info.patch "