PHP 8.1.21: Downloads, Changelog, News

Release Information

Release
8.1.21
PHP Version
PHP 8.1
Release Date
Release Type
Bug Fix Release
Release Status
Use PHP 8.1.30 instead
Branch Status
Security-Fixes Only

PHP 8.1 is currently only receiving security fixes. PHP 8.1.21 is not the latest version in the series, and using this release is not recommended. PHP 8.1.30 is the latest in the series.

Downloads

Source Code

Git Clone
Use Git to clone the 8.1.21 tag from the PHP Git repository.
git clone https://github.com/php/php-src.git --depth 1 --branch php-8.1.21
How to compile PHP
PHP can be compiled by setting up the dependencies, building the configure script (./buildconf), configuring the build ./configure, and running make.
Detailed articles on how to compile PHP are available for Ubuntu/Debian based systems and Fedora/RHEL based systems.

Windows binaries

Non-Thread Safe Builds
Non-Thread Safe (NTS) builds are single-threaded PHP builds. They can be used on web servers that integrate PHP over FastCGI protocol, such as Nginx, Caddy, and IIS.
Thread-Safe Builds
Thread-Safe (TS) builds are multi-thread PHP builds, often used to integrate PHP as a Server API for multithreaded servers. The most common use case is using PHP as an Apache module.

Docker/Podman Containers

PHP CLI
PHP CLI Containers images only include the PHP CLI, and no FPM or Apache modules. The Alpine builds are lightweight, but may introduce incompatibilities due to their musl builds. Albeit their larger size, the Debian-based (without the "-alpine" suffix) images are more complete, and widely used.

Alpine-based: Lightweight, but may introduce incompatibilities due to their musl builds.
docker pull php:8.1.21-cli-alpine

Debian-based: More compatible with other components, complete, and are widely used.
docker pull php:8.1.21-cli
PHP CLI + Web Server Integration
These container images include PHP CLI, and a web server integration. FPM container images can be integrated with web servers such as Nginx, Caddy, and Apache with Event MPM. The Apache container images include Apache web server, integrating PHP as an Apache module.

Alpine-based: Lightweight, but may introduce incompatibilities due to their musl builds.
docker pull php:8.1.21-fpm-alpine

Debian-based ZTS Apache: Includes Apache web server integrating PHP as an Apache module.
docker pull php:8.1.21-apache

Debian-based NTS FPM: PHP-FPM, can be integrated with Nginx, Caddy, and other web servers over Fast CGI.
docker pull php:8.1.21-fpm

ChangeLog

CLI

  • Fixed bug GH-11246 (cli/get_set_process_title fails on MacOS).

Core

  • Fixed build for the riscv64 architecture/GCC 12.

Curl

  • Fixed bug GH-11433 (Unable to set CURLOPT_ACCEPT_ENCODING to NULL).

DOM

  • Fixed bugs GH-11288 and GH-11289 and GH-11290 and GH-9142 (DOMExceptions and segfaults with replaceWith).
  • Fixed bug GH-10234 (Setting DOMAttr::textContent results in an empty attribute value).
  • Fix return value in stub file for DOMNodeList::item.
  • Fix spec compliance error with '*' namespace for DOMDocument::getElementsByTagNameNS.
  • Fix DOMElement::append() and DOMElement::prepend() hierarchy checks.
  • Fixed bug GH-11347 (Memory leak when calling a static method inside an xpath query).
  • Fixed bug #67440 (append_node of a DOMDocumentFragment does not reconcile namespaces).
  • Fixed bug #81642 (DOMChildNode::replaceWith() bug when replacing a node with itself).
  • Fixed bug #77686 (Removed elements are still returned by getElementById).
  • Fixed bug #70359 (print_r() on DOMAttr causes Segfault in php_libxml_node_free_list()).
  • Fixed bug #78577 (Crash in DOMNameSpace debug info handlers).
  • Fix lifetime issue with getAttributeNodeNS().
  • Fix "invalid state error" with cloned namespace declarations.
  • Fixed bug #55294 and #47530 and #47847 (various namespace reconciliation issues).
  • Fixed bug #80332 (Completely broken array access functionality with DOMNamedNodeMap).

Opcache

  • Fix allocation loop in zend_shared_alloc_startup().
  • Access violation on smm_shared_globals with ALLOC_FALLBACK.
  • Fixed bug GH-11336 (php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked).

OpenSSL

  • Fixed bug GH-9356 Incomplete validation of IPv6 Address fields in subjectAltNames

PGSQL

  • Fixed intermittent segfault with pg_trace.

Phar

  • Fix cross-compilation check in phar generation for FreeBSD.

SPL

  • Fixed bug GH-11338 (SplFileInfo empty getBasename with more than one slash).

Standard

  • Fix access on NULL pointer in array_merge_recursive().
  • Fix exception handling in array_multisort().

Commit List

Daniil Gentili

David CARLIER

  • ext/pgsql: fix PGtrace invalid free issue in f194cdf852

divinity76

  • Fix return value in stub file for DOMNodeList::item in 761b9a44f8

Dmitry Stogov

  • Fixed deoptimization info for interrupt handler in 8f06febedf
  • Keep consistent EG(current_execute_data) after return from generator in GH-11380
  • Fixed incorrect VM stack overflow checks elimination in 1a96d64828

Ilija Tovilo

  • Fix access on NULL pointer in array_merge_recursive() in f5c54fd88b
  • Fix exception handling in array_multisort() in b2ec6c24f8

Jakub Zelenka

  • Fix CS and checking for IPv6 SAN verify in 3fc013b2e2
  • FPM: Add "pcntl" when running another test depending on pcntl in 9b18466396

James Lucas

KoudelkaB

  • Access violation when ALLOC_FALLBACK fixed in 8946b7b141

Mikhail Galanin

  • sapi/fpm: add "pcntl" when running test depending pcntl_sigprocmask() in 7ade242e28

nielsdos

  • Fix allocation loop in zend_shared_alloc_startup() in 6267601f84
  • Fix GH-11288 and GH-11289 and GH-11290 and GH-9142: DOMExceptions and segfaults with replaceWith in cba335d61e
  • Fix DOMElement::append() and DOMElement::prepend() hierarchy checks in b374ec399d
  • Fix GH-11347: Memory leak when calling a static method inside an xpath query in 7812772105
  • Fix test failure for init_fcall_003.phpt without opcache in cced0ddf9d
  • Fix #70359 and #78577: segfaults with DOMNameSpaceNode in f2d673fb18
  • Fix GH-11433: Unable to set CURLOPT_ACCEPT_ENCODING to NULL in a8a3b99e00
  • Fix bug #55294 and #47530 and #47847: namespace reconciliation issues in b30be40b86
  • Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM in 7eb3e9cd17
  • Revert "Fix GH-11404: DOMDocument::savexml and friends ommit xmlns="" declaration for null namespace, creating incorrect xml representation of the DOM" in c174ebfce0

Niels Dossche

  • Fix GH-10234: Setting DOMAttr::textContent results in an empty attribute value in c473787abb
  • Fix GH-11338: SplFileInfo empty getBasename with more than one slash in bce536067c
  • Fix GH-11336: php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked in 9c59d22a7b
  • Fix spec compliance error for DOMDocument::getElementsByTagNameNS in 154c251013
  • Fix bug #67440: append_node of a DOMDocumentFragment does not reconcile namespaces in b1d8e240e6
  • Fix bug #81642: DOMChildNode::replaceWith() bug when replacing a node with itself in 23f7002527
  • Fix bug #77686: Removed elements are still returned by getElementById in 0e34ac864a
  • Fix missing randomness check and insufficient random bytes for SOAP HTTP Digest in ac4254ad76
  • Fix lifetime issue with getAttributeNodeNS() in e309fd8461
  • Fix "invalid state error" with cloned namespace declarations in 10d94aca4c
  • Fix #80332: Completely broken array access functionality with DOMNamedNodeMap in 9f7d88802e

Patrick Allaert

Peter

  • Fix cross-compilation check in phar generation for FreeBSD in 4fcb3e0d34

Pierrick Charron

Remi Collet

Yuya Hamada

  • Fix mb_strlen is wrong length for CP932 when 0x80 in c50172e812
Subscribe to PHP.Watch newsletter for monthly updates

You will receive an email on last Wednesday of every month and on major PHP releases with new articles related to PHP, upcoming changes, new features and what's changing in the language. No marketing emails, no selling of your contacts, no click-tracking, and one-click instant unsubscribe from any email you receive.

Support PHP.Watch — If you find the articles, version information, Codex, and other PHP.Watch contributions useful, consider supporting through GitHub Sponsors. Your sponsorship helps dedicate more time to creating valuable content and improving the PHP community. Together, we can keep the momentum going — thank you for your support!

Thanks to the highest tier sponsor: @TomasVotruba for your generous support to keep PHP.Watch moving 💜