Patch PHP2Shell on RHEL, Rocky, Alma and Remi
On Red Hat family systems PHP comes from the distribution (module streams on RHEL, Rocky and Alma, plain dnf on Fedora) or from Remi’s repository. The distribution is the dependable source; Remi is run by volunteers, and PHP’s advisory warned it would not have the fix on release day.
- You need
- root or sudo
- Updated
- By
- PXL
Fixed in
- The module stream or Remi package update once published
Affected: Any RHEL, Rocky Linux, AlmaLinux, CentOS or Fedora server whose PHP packages predate the security update.
Update PHP
Pick the tab that matches where your PHP comes from. The distribution is the dependable path. Remi’s repository is run by volunteers, and PHP’s advisory of 21 October said it would not have the update that day, so confirm its packages carry the fix before relying on them.
PHP is a module stream. Update on your current stream, or reset the module and enable the branch you want before updating.
01Update on the current stream
Install the latest packages for the stream you already run.
sudo dnf update php02Or switch the module stream
Reset the module, enable the stream you want and update.
sudo dnf module reset php sudo dnf module enable php:8.3 sudo dnf update php
Build from source
If no fixed package is available for your system, build the fixed version for your branch from source. The main PHP build guide at /patched/php has the steps.
Reload PHP-FPM and restart workers
01Reload PHP-FPM, then restart any long-lived workers
Reload the service so it runs the updated binary. A package update does not restart long-lived workers, so restart Octane, Horizon, queue workers, Swoole or RoadRunner separately.
sudo systemctl reload php-fpm