Skip to content
PHP released the fixed versions on 21 October at 14:00 UTC. Update PHP on every server you run.CERT-EU advisory
php2shell.xyz
Application serverAction needed

Patch PHP2Shell on Swoole and OpenSwoole

Swoole and OpenSwoole load into PHP as a compiled extension and run your application in long-lived workers. The fix is a PHP update, but the extension is a binary tied to the PHP it was built against, and the workers hold state between requests. Update PHP, rebuild the extension against it if the PHP build changed, then fully restart.

You need
Root or sudo on the host. To rebuild the extension from source you also need the PHP development tools (phpize and a C compiler).
Updated
By
PXL

Fixed in

  • 8.2.35
  • 8.3.36
  • 8.4.27
  • 8.5.12

Affected: Any Swoole or OpenSwoole deployment on a PHP version older than the fixed versions.

How the fix reaches Swoole

The flaw is in PHP, not in Swoole. Swoole and OpenSwoole are PECL extensions compiled against a particular PHP build and loaded into it, so updating PHP is the fix. Two things make this different from a plain PHP-FPM server. The extension is a binary tied to the PHP ABI it was built against, so a new PHP build can need a matching rebuild. And the server runs your application in workers that stay alive across requests, which is the state CVE-2026-109619 relies on, so the workers have to be replaced, not reloaded.

Update PHP

  1. 01Install the fixed version for your branch

    Each fixed release closes both CVEs. Install the first one on the branch you run.

    PHP 8.2 → 8.2.35
    PHP 8.3 → 8.3.36
    PHP 8.4 → 8.4.27
    PHP 8.5 → 8.5.12

Rebuild the extension against the new PHP

If the update stayed on the same branch (a patch release such as 8.3.35 to 8.3.36), the extension ABI is unchanged and the existing binary keeps loading, so you can go straight to the restart. If you moved to a new minor branch or to a PHP you built yourself, rebuild the extension against it. PECL builds against the PHP it finds on PATH, so check that first.

  1. 01Confirm which PHP is on PATH

    The rebuild must target the updated PHP. Check the version before building.

    php -v
  2. 02Reinstall through PECL

    Reinstall the extension so it is compiled against the updated PHP.

    pecl install swoole
    # OpenSwoole:
    pecl install openswoole
  3. 03Confirm it is enabled

    The extension is enabled by a line in the php.ini the server loads.

    extension=swoole.so   # OpenSwoole: extension=openswoole

Or build from source

To build without PECL, compile the extension against the updated PHP. phpize reads that PHP’s build configuration, so run it with the updated PHP on PATH. Run ./configure --help first to see optional integrations such as --enable-sockets or --enable-openssl.

  1. 01Build and install Swoole

    From the extension source directory, prepare the build, then compile and install it.

    phpize
    ./configure
    make -j"$(nproc)"
    sudo make install
  2. 02OpenSwoole builds the same way

    OpenSwoole ships its source on GitHub. Clone it, check out the release you want, then build it against the updated PHP.

    git clone https://github.com/openswoole/ext-openswoole.git
    cd ext-openswoole
    phpize
    ./configure
    make -j"$(nproc)"
    sudo make install

Restart the server, don’t reload it

A hot reload can leave old workers running, and an old worker keeps the vulnerable PHP and its surviving state. A full stop and start replaces every worker with one running the patched binary.

sudo systemctl restart your-swoole-service

Verify

Check the PHP version the workers run and the extension loaded into it. The PHP version must be the fixed release for its branch or later.

php -v
php --ri swoole   # OpenSwoole: php --ri openswoole

Sources