[PHP-DEV] [RFC] Concurrency Support in the PHP Engine

Hello everyone

I’ve started integrating the codebase with the Scheduler API + Poll
API ([PHP-DEV] [RFC] Polling API Additions)
to test these RFCs for bugs.
The implementation is still fairly rough, but I think the situation
will change significantly over the next 2–3 months.
I’ll post an update here later with the results.

P.S. Heh, the bugs I’ve found so far were in completely different
modules as well. :slight_smile:

чт, 23 июл. 2026 г. в 11:58, Edmond Dantes <edmond.ht@gmail.com>:

Hi internals,

I would like to open the discussion of a new RFC:

PHP: rfc:async_scheduler_abi

The proposal gives the engine a coroutine representation and makes the
component that drives coroutines, the scheduler, pluggable by an
extension. It adds no classes, no functions, no constants and no
syntax: the engine compiles in no PHP symbols at all. With no scheduler
registered, PHP behaves exactly as it does today.

This is not the True Async RFC. It is the minimal engine core extracted
from that work: the activation contract, the notifications the engine
raises, adoption of fibers onto the scheduler, and per-coroutine
storage. Any user-facing API (spawn(), await(), channels) stays in
extension space; True Async is one possible provider on top, not the
subject of this proposal.

The implementation exists, and I am the one contributing it:

Zend async Scheduler ABI by EdmondDantes · Pull Request #22561 · php/php-src · GitHub

The PR carries the engine changes plus an in-tree reference scheduler
(ext/test_scheduler, disabled by default) that fills every slot from an
ordinary extension; the upstream test suites run unchanged and
schedulerless in the same binary. A bridge extension that registers a
scheduler written in plain PHP exists out of tree, as runtime proof
that the seam is sufficient.

Points likely of interest for existing code: a scheduler can adopt
fibers started by ReactPHP, Revolt or AMPHP, per fiber and declinable;
the proposal ships the per-coroutine storage that would later let
ob_start() and friends become coroutine-safe; there are no goroutines
and no parallelism, everything runs in one OS thread.

Feedback is welcome.

Regards,
Edmond