PHP 8.1 is currently only receiving security fixes. PHP 8.1.20 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.
Downloads
Source Code
Git Clone
Use Git to clone the 8.1.20 tag from the PHP Git repository.
git clone https://github.com/php/php-src.git --depth 1 --branch php-8.1.20
How to compile PHP
PHP can be compiled by setting up the dependencies, building the configure script (
Detailed articles on how to compile PHP are available for Ubuntu/Debian based systems and Fedora/RHEL based systems.
./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.
php-8.1.20-x64NTS.zip (29.27 MiB)
php-8.1.20-x86NTS.zip (26.33 MiB)
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.
php-8.1.20-x64TS.zip (29.37 MiB)
php-8.1.20-x86TS.zip (26.31 MiB)
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.20-cli-alpine
Debian-based: More compatible with other components, complete, and are widely used.
docker pull php:8.1.20-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.20-fpm-alpine
Debian-based ZTS Apache: Includes Apache web server integrating PHP as an Apache module.
docker pull php:8.1.20-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.20-fpm
ChangeLog
Core
- Fixed bug GH-9068 (Conditional jump or move depends on uninitialised value(s)).
- Fixed bug GH-11189 (Exceeding memory limit in
zend_hash_do_resize
leaves the array in an invalid state). - Fixed bug GH-11222 (foreach by-ref may jump over keys during a rehash).
Date
- Fixed bug GH-11281 (
DateTimeZone::getName()
does not include seconds in offset).
Exif
- Fixed bug GH-10834 (
exif_read_data()
cannot read smaller stream wrapper chunk sizes).
FPM
- Fixed bug GH-10461 (PHP-FPM segfault due to after free usage of child->ev_std(out|err)).
- Fixed bug #64539 (FPM status page: query_string not properly JSON encoded).
- Fixed memory leak for invalid primary script file handle.
Hash
- Fixed bug GH-11180 (
hash_file()
appears to be restricted to 3 arguments).
LibXML
- Fixed bug GH-11160 (Few tests failed building with new libxml 2.11.0).
Opcache
- Fixed bug GH-11134 (Incorrect match default branch optimization).
- Fixed too wide OR and AND range inference.
- Fixed bug GH-11245 (In some specific cases SWITCH with one default statement will cause segfault).
PGSQL
- Fixed parameter parsing of
pg_lo_export()
.
Phar
- Fixed bug GH-11099 (Generating
phar.php
during cross-compile can't be done).
Soap
- Fixed bug GHSA-76gg-c692-v2mw (Missing error check and insufficient random bytes in HTTP Digest authentication for SOAP). (CVE-2023-3247)
- Fixed bug GH-8426 (make test fail while soap extension build).
SPL
- Fixed bug GH-11178 (Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)).
Standard
- Fixed bug GH-11138 (
move_uploaded_file()
emitsopen_basedir
warning for source file). - Fixed bug GH-11274 (POST/PATCH request switches to GET after a HTTP 308 redirect).
Streams
Commit List
Amedeo Baragiola
- Fix compilation error on old GCC versions in 175ff603c3
Ben Ramsey
- Update versions for PHP 8.1.20 in 418d1f85f4
Bob Weinand
- Fix GH-11189: Exceeding memory limit in
zend_hash_do_resize
leaves the array in an invalid state in 05bd1423ee - Fix GH-11222: foreach by-ref may jump over keys during a rehash in 975d28e278
Dmitry Stogov
- JIT: Fixed inaccurate range inference usage for UNDEF/NULL/FALSE in 25ad171f63
- Fixed GH-11127 (JIT fault) in ed0b593c11
Ilija Tovilo
- Fix incorrect match default branch optimization in 3a76f795f8
- Propagate STREAM_DISABLE_OPEN_BASEDIR src flag to
php_stream_stat_path_ex
in 8bf2d587d7 - Update libenchant in arm build in 5cbc917fee
- Endless recursion when using + on array in foreach in dc20cd9c3a
- Add retry mechanism in
run-tests.php
in 11597d18d6 - Fix use-of-uninitialized value in
phar_object.c
in 78ec64af44 - Fix compilation for PHP 8.1 in 8f66b67ccf
Jakub Zelenka
- Fix GH-10461: Postpone FPM child freeing in event loop in 102953735c
- Expose JSON internal function to escape string in e8a836eb39
- Fix bug #64539: FPM status - query_string not properly JSON encoded in 5e64ead64a
- FPM: Fix memory leak for invalid primary script file handle in 4294e8d448
- Fix FPM status json encoded value test in aa061cd40b
Máté Kocsis
- Fix ZPP of
pg_lo_export()
in f0149c5c0b
nielsdos
- Fix too wide OR and AND range inference in fbf5216ca0
- Fix GH-9068: Conditional jump or move depends on uninitialised value(s) in 4ca8daf3ed
- Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour in d75c1d00a9
- Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18) in 81e50b4ee3
- Fix GH-8426: make test fail while soap extension build in 6ba0b06819
Niels Dossche
- Fix GH-10031: [Stream] STREAM_NOTIFY_PROGRESS over HTTP emitted irregularly for last chunk of data in b33fbbfe3d
- Fix GH-11160: Few tests failed building with new libxml 2.11.0 in 7c0dfc5cf5
- Fix GH-11180:
hash_file()
appears to be restricted to 3 arguments in baa07f3de3 - Fix GH-10834:
exif_read_data()
cannot read smaller stream wrapper chunk sizes in 7b768485f3 - Fix GH-11274: POST/PATCH request via file_get_contents +
stream_context_create
switches to GET after a HTTP 308 redirect in 1ede3137c9 - Fix GH-11245 (In some specific cases SWITCH with one default statement will cause segfault) in 5cad1a7176
- Fix GH-11281:
DateTimeZone::getName()
does not include seconds in offset in f9117eb824 - Fix missing randomness check and insufficient random bytes for SOAP HTTP Digest in 8648eba93a
Peter
- Fix GH-11099: Generating
phar.php
during cross-compile can't be done in 93fa9613e1