PHP 8.1.2: Downloads, Changelog, News

Release Information

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

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


Source Code

Git Clone
Use Git to clone the 8.1.2 tag from the PHP Git repository.
git clone --depth 1 --branch php-8.1.2
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 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.2-cli-alpine

Debian-based: More compatible with other components, complete, and are widely used.
docker pull php:8.1.2-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.2-fpm-alpine

Debian-based ZTS Apache: Includes Apache web server integrating PHP as an Apache module.
docker pull php:8.1.2-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.2-fpm



  • Fixed bug #81216 (Nullsafe operator leaks dynamic property name).
  • Fixed bug #81684 (Using null coalesce assignment with $GLOBALS["x"] produces opcode error).
  • Fixed bug #81656 (GCC-11 silently ignores -R).
  • Fixed bug #81683 (Misleading "access type ... must be public" error message on final or abstract interface methods).
  • Fixed bug #81585 (cached_chunks are not counted to real_size on shutdown).
  • Fixed bug GH-7757 (Multi-inherited final constant causes fatal error).
  • Fixed zend_fibers.c build with ZEND_FIBER_UCONTEXT.
  • Added riscv64 support for fibers.




  • Fixed bug GH-7759 (Incorrect return types for hash() and hash_hmac()).
  • Fixed bug GH-7826 (Inconsistent argument name in hash_hmac_file and hash_file).


  • Fixed bug #81693 (mb_check_encoding(7bit) segfaults).


  • Fixed bug #81658 (MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in MariaDB).
  • Introduced MYSQLI_IS_MARIADB.
  • Fixed bug GH-7746 (mysqli_sql_exception->getSqlState()).


  • Fixed bug where large bigints may be truncated.


  • Fixed bug GH-7765 (php_oci_cleanup_global_handles segfaults at second call).


  • Fixed bug #81679 (Tracing JIT crashes on reattaching).


  • Fixed bug #81598 (Cannot input unicode characters in PHP 8 interactive shell).


  • Fixed bug #81681 (ReflectionEnum throwing exceptions).


  • Fixed error message allocation of PDO PgSQL.


  • Avoid void* arithmetic in sockets/multicast.c on NetBSD.
  • Fixed ext/sockets build on Haiku.


  • Fixed bug #75917 (SplFileObject::seek broken with CSV flags).
  • Fixed bug GH-7809 (Cloning a faked SplFileInfo object may segfault).


  • Fixed bug GH-7748 (gethostbyaddr outputs binary string).
  • Fixed bug GH-7815 (php_uname doesn't recognise latest Windows versions).

Commit List

Alex Dowad

  • mb_convert_encoding will not auto-detect input string as UUEncode, Base64, QPrint in f07c193583

Aliaksandr Bystry

Ben Ramsey

Christoph M. Becker

  • Fix #81681: ReflectionEnum throwing exceptions in 59dd4fd742
  • Fix #81693: mb_check_encoding(7bit) segfaults in 929d847152
  • Use php/php-sdk-binary-tools.git for AppVeyor builds in 582a291c98
  • Skip bug_36798.phpt for PDO_DBLIB in efb901ebed
  • Fix #81585: cached_chunks are not counted to real_size on shutdown in 5675ebe649
  • Fix GH-7748: gethostbyaddr outputs binary string in 7daf01258d
  • Fix openssl_x509_checkpurpose_basic.phpt in 98175fc7f1
  • Fix GH-7759: Incorrect return types for hash() and hash_hmac() in 0b3a937670
  • macOS 10.14 runners are no longer available via Azure Pipeline in 6d5f2ba78d
  • Fix GH-7757: Multi-inherited final constant causes fatal error in 206c521a1f
  • Fix GH-7765: php_oci_cleanup_global_handles segfaults at second call in c435e67746
  • Fix #81679: Tracing JIT crashes on reattaching in 49380b59d2
  • $context parameter of get_headers() is nullable in c5f4ee50ab
  • Fix GH-7809: Cloning a faked SplFileInfo object may segfault in 0ed39ed809
  • Fix chunk_split_variation*_32bit.phpt for Windows in b4ba65dd9d
  • Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file in fd3fc5c193
  • Prevent strict interpretation of tentative definition in e76ddbd2f6
  • Mark curl tests using as XFAIL in 5005445994
  • Fix bug40228*.phpt conflict in 7f0a1e2f2d
  • Revert "Fix zend_observer_fcall_end_all() accessing dangling pointers" in ee610947ce
  • Don't truncate subsecond precision in run-tests.php JUNIT output in 87d9e02f01
  • mysqli_next_result_no_repeat_error.phpt must not use --EXTENSIONS-- in d963b3f015

David Carlier

  • Fix #81658: MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in MariaDB in 15e7e570a5
  • socket: ancillary credentials build fix for non linux systems in 51647eb23e
  • socket cmsg credential test fixes, "backporting" from the FreeBSD PR in 80b02275bb
  • Avoid void* arithmetic in sockets/multicast.c on NetBSD in 3f0bb67361
  • Fix buffer allocations in zlog_stream_set_msg_suffix() in cb3d858745
  • Fix ext/sockets build on Haiku in 09165ace37


David Warner

Dmitry Stogov

  • Fix yet another indirect string modification by error handler problem in 94286cd596
  • JIT: Fix ASSIGN_DIM_OP with undefined variable and index and user error handler, throwing an exception in 2fde308fc6
  • Add test in 42a162e535
  • Tracing JIT: Fixed Zend/tests/str_offset_008.phpt failure in c4ee66856e
  • JIT: Fix register clobbering in 2515e788bc
  • Fix array object clobbering by user error handler in 1d054b3fa7
  • ws in 4a5c05a49d
  • Add test in 8d7d87cdc4
  • Add missing "return" in c9901aa594
  • Fixed bug #81216 (Nullsafe operator leaks dynamic property name) in 307e476e86
  • Fix refcount inferemce ($a += $a returns old array with RCN) in aa7280264e
  • Fix use after free because of data clobbering by user error handler in 5459ed4c2f
  • JIT: Fix incorrect elimination of type store in c29f6baaee
  • Fixed incorrect DCE of a constructor call in 7b629afe4e
  • Separate "cold" code in 08f1d470fb
  • Fix crush after compilation of nullsafe operator introduced in 307e476e in 7e080183f4
  • Fix incorrect JMP optimization in 0ac3d78d7d
  • Remove range inference for booleans in 6f42c073cf
  • JIT: Fix crash during compilation of function with incompletely constructed SSA in e79dbe1124
  • Fix incorrect optimization that leads to memory leak in 230de7721f
  • Fix array clobering by user error handler in cbc0b1afeb
  • Tracing JIT: Fix reference counting in fe320e83ae
  • Combine ADDREF/DELREF in c787f42ceb
  • Preloading: don't remove INCLUDE_OE_EVAL nstructions with used result in cd8e6f5f7b
  • Move common code into helper in b16fc350a4
  • Fix array clobbering by user error handler in 75b2973974
  • JIT: Fix incorrect type store elimination in 66306030ad
  • Fix array clobbering by user error handler in 2745cd9997
  • Fix type inference for INIT_ARRAY with invalid index in f18bb2477f
  • JIT: Fix register clobbering in 7c674e1aa7
  • Fix incorrect optimization of ASSIGN_OP that may lead to memory leak in e004e844f7
  • JIT: Fix incorrect JIT prologur size for CLANG/x86 build in 6d5922bed5
  • Fixed compilation warning in cb10ac1d53
  • Fix memory leak in SCCP in 2b81156f2a
  • Fix reference contig inference in de358f856f
  • JIT: Fix array clobbering by user error handler in fd879e6fe4
  • iSeparate tests in 206bcff50d

Florian Sowade

  • Fix zend_observer_fcall_end_all() accessing dangling pointers in 76e2a8380e

Gabriel Caruso

Ilija Tovilo

  • Fix invalid opcode for ??= on $GLOBALS in dab6226cbe
  • Improve final/abstract methods in interfaces error messages in b991ce9c1e

Jeremie Courreges-Anglas

Kamil Tekiela

Michael Wallner

Máté Kocsis

  • Fix the value param of SimpleXMLElement::addAttribute() in 713dcb2818
  • Remove bogus type of $object param in SplObjectStorage::offsetSet() in 24be11f632
  • Redefine PDOException::$code with correct type in 96a5026bfd
  • Mark mysqli_driver properties readonly in f70ca0acd4


  • Fix bug where large bigints may be truncated in b3903515bf

Nikita Popov

  • Fix bug #81598: Use C.UTF-8 as LC_CTYPE locale by default in 26e424465c
  • Don't convert assign op operand types in opcache in cf377eefa6
  • Handle holes in zend_get_opcode_id() in b63e4cf727

Patrick Allaert

Petr Sumbera

  • Fix zend_fibers.c build with ZEND_FIBER_UCONTEXT in 069bbf3e80

SATO Kentaro

  • Fix error message allocation of PDO PgSQL in 778513f605

Yifan Tong

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.