Patch PHP2Shell on LiteSpeed and OpenLiteSpeed
LiteSpeed and OpenLiteSpeed serve PHP through their own lsphp builds, external LSAPI worker processes. The fix is to move every lsphp you run to a fixed PHP version, from LiteSpeed’s repository, your control panel or a source build, then restart the server so the workers reload.
- You need
- root or sudo on the server, and the PHP branch each lsphp build runs.
- Updated
- By
- PXL
Fixed in
- lsphp 8.2.35
- lsphp 8.3.36
- lsphp 8.4.27
- lsphp 8.5.12
Affected: Any LiteSpeed or OpenLiteSpeed server whose lsphp packages predate the fixed versions, including cPanel and control-panel installs that build PHP through LiteSpeed.
How LiteSpeed runs PHP
LiteSpeed and OpenLiteSpeed don’t embed PHP. They start external lsphp processes and talk to them over LSAPI, the LiteSpeed SAPI. Each lsphp is an ordinary PHP build compiled with LSAPI support, and one server often runs several at once, one per PHP version (lsphp82, lsphp83, lsphp84) and sometimes per site. The flaw is in PHP, so the fix is to move every lsphp you run to a fixed version. No web-server setting changes it.
Update the lsphp packages
The dependable source is LiteSpeed’s own repository: upgrade the lsphp packages for every branch you run, and upgrade each lsphp component, not just the core package. On cPanel the builds come from EasyApache instead. Choose your platform.
Refresh the package lists and upgrade every installed lsphp build to the newest release on its branch.
# first time only: add the LiteSpeed repository
sudo wget -O - https://repo.litespeed.sh | sudo bash
sudo apt update && sudo apt upgrade lsphp*Build lsphp from source
Where the repository isn’t available, or you need a custom build, compile PHP with LSAPI yourself. LiteSpeed documents this but recommends the repository over it, and notes that compiling PHP is outside their web-server support. Build each lsphp into its own prefix so it doesn’t overwrite system PHP, and point it at the fixed version for the branch.
01Download the fixed PHP source
Fetch the tarball for the branch this lsphp runs.
sudo wget https://www.php.net/distributions/php-8.3.36.tar.gz sudo tar -xf php-8.3.36.tar.gz cd php-8.3.3602Configure with the LSAPI SAPI
The --enable-litespeed flag builds the LiteSpeed SAPI and is required for an lsphp binary. Set --prefix to a per-version path under /usr/local/lsws and add the extensions you need. (PHP 7.3 and earlier use the older --with-litespeed, as does php.net’s manual example.)
sudo ./configure --prefix=/usr/local/lsws/lsphp83 --enable-litespeed \ --with-mysqli --with-zlib --enable-mbstring --with-curl03Build and install
Compile and install the new lsphp into its prefix.
sudo make sudo make install04Confirm it is an LSAPI build
Run the new binary. A LiteSpeed build prints (litespeed) in the version line.
/usr/local/lsws/lsphp83/bin/php -v # PHP 8.3.36 (litespeed) (built: ...)
Restart LiteSpeed so the workers reload
lsphp workers are long-lived, so they keep running the old binary until the server restarts them, the same stale state that CVE-2026-109619 turns on. A graceful restart through lswsctrl spawns fresh lsphp children on the new build. Reloading one site, or restarting a single site’s PHP in a control panel, is not enough; restart the whole server.
sudo /usr/local/lsws/bin/lswsctrl restartConfirm the update
Check the version of each lsphp you run.
/usr/local/lsws/lsphp83/bin/php -v