| Tested on | Rocky Linux 10.2 (Red Quartz) |
|---|---|
| Package | php 8.4.21 |
| Applies to | RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora |
| Privilege | sudo or root |
| Scope | Install PHP 8.4 on Rocky Linux, RHEL, AlmaLinux, and Oracle Linux, including 10.2+, Rocky Linux, AlmaLinux, Oracle Linux, and CentOS Stream when dnf info php8.4 confirms availability. |
| Related guides | Add Linux To Windows Ad Domain Realm Boom Boot Linux Lvm Snapshot Rhel 8 Linux Boot In Single User Mode Rhel Centos 8 Linux Boot Rescue Mode Iso Rhel Centos 7 Boot With Old Kernel Version Rhel 8 Grubby |
PHP 8.4 is available through native AppStream repositories on RHEL 10.2 and compatible Rocky Linux, AlmaLinux, and Oracle Linux releases, and on CentOS Stream 10 when dnf info php8.4 confirms the package set. This guide installs PHP 8.4 from the distribution php8.4-* packages, adds common extensions, configures PHP-FPM, and verifies Apache or Nginx integration on a host that does not already run a conflicting PHP major release.
php8.4-* packages are available in RHEL 10.2 and compatible Rocky Linux, AlmaLinux, and Oracle Linux releases. AppStream on EL 10.0 and 10.1 does not publish that package set. On CentOS Stream 10, check dnf info php8.4 directly—CentOS Stream does not use the same downstream minor-release gate. This guide does not use dnf module enable, dnf module reset, or dnf module switch-to; PHP in EL10 is non-modular.
php -v already reports PHP 8.3, do not treat this page as an in-place upgrade. Use upgrade PHP 8.3 to 8.4 on Enterprise Linux instead of running a fresh-install workflow over an existing PHP 8.3 package set.
Prerequisites
- RHEL, Rocky Linux, AlmaLinux, or Oracle Linux 10.2+ with AppStream enabled, or CentOS Stream 10 where
dnf info php8.4confirms package availability. - sudo command or root access for package installation and service management.
- A fresh host, or a host where unprefixed
php-*packages from PHP 8.3 are not already installed. If PHP 8.3 is present, follow the upgrade guide instead. - Outbound network access to distribution repositories.
For a full LAMP or LEMP baseline beyond the PHP-focused steps here, see install LAMP stack on Rocky Linux and install LEMP stack on Rocky Linux.
Different Install approach
| Approach | Best for | Covered in this guide |
|---|---|---|
| Native AppStream packages | RHEL 10.2+, compatible Rocky/Alma/Oracle releases, or CentOS Stream 10 with php8.4 in AppStream |
Yes — steps below |
| Third-party repositories (for example Remi) | Multiple PHP versions on one host, or releases without native PHP 8.4 | No — different package names, repository setup, and often DNF module streams |
| Containers or virtual machines | Hard isolation between PHP major versions | No — use a container image or a separate host |
This guide installs PHP 8.4 only from native AppStream php8.4-* packages. Red Hat documents that set as available since RHEL 10.2; the install command is dnf install php8.4.
Consider Remi, containers, or a separate VM when:
dnf info php8.4reports no matching package on your release- You need two PHP major versions on one machine without replacing the system default
- Your organization standardizes on a community PHP packaging stream
Do not mix a native php8.4 install with an existing unprefixed PHP 8.3 package set on the same host.
| Item | Native AppStream (this guide) |
|---|---|
| Install command | dnf install php8.4 |
| Extension packages | php8.4-mysqlnd, php8.4-fpm, and other php8.4-* RPMs |
| CLI binary | /usr/bin/php |
| FPM service | php-fpm.service |
| FPM binary | /usr/sbin/php-fpm |
| FPM socket | /run/php-fpm/www.sock |
php.ini |
/etc/php.ini |
| Drop-in configuration | /etc/php.d/ |
| Pool configuration | /etc/php-fpm.d/ |
The php8.4-* prefix is a versioned RPM namespace. It does not create a second parallel php binary or service name on the host.
After installation, continue with verify the installation, update packages, or uninstall if you need those workflows. To replace PHP 8.3, use upgrade PHP 8.3 to 8.4.
Install PHP 8.4 from native AppStream
This is the path tested on Rocky Linux 10.2.
Check package availability
Identify the operating system:
cat /etc/os-releaseSample output:
NAME="Rocky Linux"
VERSION="10.2 (Red Quartz)"
VERSION_ID="10.2"
PLATFORM_ID="platform:el10"
PRETTY_NAME="Rocky Linux 10.2 (Red Quartz)"VERSION_ID must be 10.2 or newer on RHEL, Rocky Linux, AlmaLinux, and Oracle Linux. On EL 10.0 or 10.1, dnf install php8.4 returns No match for argument. CentOS Stream 10 is a continuously delivered branch—use dnf info php8.4 on that distribution instead of relying on a 10.2 point-release value.
Confirm AppStream is enabled:
dnf repolist --enabledSample output:
repo id repo name
appstream Rocky Linux 10 - AppStream
baseos Rocky Linux 10 - BaseOS
extras Rocky Linux 10 - ExtrasLook up the meta package:
dnf info php8.4Sample output:
Available Packages
Name : php8.4
Version : 8.4.21
Release : 1.el10_2
Repository : appstream
Summary : PHP scripting language for creating dynamic web sitesIf php8.4 is missing, refresh enabled repository metadata with sudo dnf makecache --refresh, then run dnf info php8.4 again.
Check whether another PHP major release is already installed:
php -vIf the command reports PHP 8.3, stop here and use the upgrade guide. If php is not found, continue with a fresh install.
Install PHP 8.4
Install the meta package from AppStream:
sudo dnf install php8.4DNF pulls in php8.4-cli, php8.4-common, and dependencies. The CLI binary remains /usr/bin/php.
Verify the version:
php -vSample output:
PHP 8.4.21 (cli) (built: May 5 2026 16:34:12) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Rocky Enterprise Software Foundation
Zend Engine v4.4.21, Copyright (c) Zend Technologies
with Zend OPcache v8.4.21, Copyright (c), by Zend TechnologiesSee which configuration files apply:
php --iniSample output:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/10-opcache.ini,
/etc/php.d/20-bz2.ini,
...Install PHP 8.4 extensions
Core php8.4 covers a useful CLI baseline. Web applications usually need database, multibyte, XML, image, and opcode-cache extensions as separate RPMs.
Install common extensions:
sudo dnf install php8.4-mysqlnd php8.4-mbstring php8.4-xml php8.4-gd php8.4-intl php8.4-opcacheList available extension packages:
dnf list available 'php8.4-*'Confirm modules load in the CLI:
php -mYou should see entries such as gd, intl, mbstring, mysqli, mysqlnd, pdo_mysql, and Zend OPcache when the matching packages are installed.
List installed 8.4 RPMs:
dnf list --installed 'php8.4-*'Configure PHP-FPM
Most EL10 web stacks use PHP-FPM behind Apache or Nginx. Install FPM if your transaction did not already include it:
sudo dnf install php8.4-fpmKeep the naming straight:
RPM package: php8.4-fpm
Service: php-fpm.service
Binary: /usr/sbin/php-fpm
Config: /etc/php-fpm.conf
Pools: /etc/php-fpm.d/There is no php8.4-fpm.service. Enable and start php-fpm with systemctl command:
sudo systemctl enable --now php-fpmCheck that the unit is active:
systemctl status php-fpmSample output:
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; preset: disabled)
Active: active (running)
Status: "Ready to handle connections"Validate the pool configuration:
php-fpm -tSample output:
[22-Jul-2026 07:05:28] NOTICE: configuration file /etc/php-fpm.conf test is successfulThe default www pool listens on a Unix socket. Match the exact listen = assignment—not other listen.* directives such as ACL settings:
grep -E '^[[:space:]]*listen[[:space:]]*=' /etc/php-fpm.d/www.confSample output:
listen = /run/php-fpm/www.sockThe configured PHP-FPM pool and the packaged Apache and Nginx integrations use the FPM configuration under /etc/php-fpm.d/. Red Hat documents PHP-FPM as the supported Apache and Nginx integration path on RHEL 10.
Use PHP 8.4 with Apache or Nginx (optional)
Both web servers talk to the same php-fpm service. Only one should bind to port 80 during quick local tests.
Apache
Install Apache if it is not already present:
sudo dnf install httpdEL10 ships FastCGI handling in /etc/httpd/conf.d/php.conf. Start both services:
sudo systemctl enable --now httpd php-fpmCreate a small test script under the Apache document root:
echo '<?php echo "PHP " . PHP_VERSION . " via " . php_sapi_name(); ?>' | sudo tee /var/www/html/test.phpRequest it locally with curl command:
curl -s http://127.0.0.1/test.phpSample output:
PHP 8.4.21 via fpm-fcgiRemove the test file when you are done: sudo rm /var/www/html/test.php.
Nginx
Install Nginx:
sudo dnf install nginxThe packaged upstream and location blocks live in /etc/nginx/conf.d/php-fpm.conf and /etc/nginx/default.d/php.conf. Nginx serves files from /usr/share/nginx/html by default—not /var/www/html.
echo '<?php echo "PHP " . PHP_VERSION . " via " . php_sapi_name(); ?>' | sudo tee /usr/share/nginx/html/test.phpStart PHP-FPM and Nginx:
sudo systemctl enable --now php-fpm nginxTest:
curl -s http://127.0.0.1/test.phpSample output:
PHP 8.4.21 via fpm-fcgiDelete the test page afterward: sudo rm /usr/share/nginx/html/test.php.
Verify the PHP 8.4 installation
Run these checks after installation.
CLI version:
php -vConfiguration paths:
php --iniLoaded modules:
php -mFPM build and SAPI:
php-fpm -i | grep -E '^(PHP Version|Server API|Loaded Configuration File)'Sample output:
PHP Version => 8.4.21
Server API => FPM/FastCGI
Loaded Configuration File => /etc/php.iniService state:
systemctl status php-fpmPool syntax check:
php-fpm -tA successful installation should show:
php -vreporting PHP 8.4.x- Expected extensions in
php -m php-fpm.serviceinactive (running)statephp-fpm -treporting a successful configuration test- A web-server
curltest returning PHP 8.4 throughfpm-fcgiwhen Apache or Nginx is configured
Confirm php-fpm remains enabled after reboot:
systemctl is-enabled php-fpmUpdate PHP 8.4 packages
Update installed PHP 8.4 packages from AppStream. The wildcard updates the meta package, CLI, FPM, and extension RPMs without naming every installed package manually.
sudo dnf upgrade 'php8.4*'When packages are already current, DNF reports Nothing to do.
Restart PHP-FPM after a server-side package update so running workers use the newly installed binaries:
sudo systemctl restart php-fpm
php -vThis handles minor package updates within PHP 8.4. Major-version upgrades from PHP 8.3 belong in upgrade PHP 8.3 to 8.4, not in this fresh-install guide.
Uninstall PHP 8.4
Back up application code and configuration before you proceed.
Stop and disable PHP-FPM:
sudo systemctl disable --now php-fpmPreview removal of every installed php8.4-* package:
sudo dnf remove --assumeno 'php8.4*'Read the full transaction. DNF can remove unused dependencies along with the selected packages.
Remove the PHP 8.4 package family after you review the list:
sudo dnf remove 'php8.4*'If Apache or Nginx was installed only as a PHP dependency, DNF may propose removing those web-server packages as well.
Confirm removal:
php -vSample output when the CLI package is gone:
bash: php: command not foundrpm -q php8.4Sample output:
package php8.4 is not installedDNF removes package-owned files. Modified RPM configuration files may be preserved with names such as .rpmsave; manually created files can also remain. Review the PHP configuration paths after removal before deleting anything.
Optional check for preserved RPM configuration files:
sudo find /etc \
\( -name '*.rpmsave' -o -name '*.rpmnew' \) \
-path '*php*'Troubleshoot PHP 8.4 installation
| Symptom | Likely cause | Direction |
|---|---|---|
No match for argument: php8.4 |
Host on EL 10.0/10.1, disabled AppStream, stale metadata, or CentOS Stream build without the package yet | On RHEL-compatible releases confirm VERSION_ID is 10.2+, enable AppStream, run sudo dnf makecache --refresh; on CentOS Stream 10 run dnf info php8.4 directly |
php reports 8.3 before install |
PHP 8.3 packages already own /usr/bin/php |
Use upgrade PHP 8.3 to 8.4 instead of this guide |
| DNF reports file conflicts | Both php-* and php8.4-* sets installed |
Remove the conflicting PHP 8.3 packages first |
php8.4-fpm.service not found |
Wrong unit name | Use systemctl status php-fpm |
| PHP-FPM fails to start | Syntax error in pool or php.ini |
Run php-fpm -t; read journalctl -u php-fpm |
Web server returns 502 Bad Gateway |
FPM down or wrong socket in vhost | Confirm php-fpm is active and fastcgi_pass / SetHandler matches /run/php-fpm/www.sock |
| Apache returns PHP source text | FastCGI proxy not active | Ensure /etc/httpd/conf.d/php.conf is loaded and php-fpm is running |
| Extension missing after install | Matching php8.4-* RPM not installed |
dnf install php8.4-<name>; verify with php -m |
| Old settings ignored | Editing wrong file or pool | Use paths from php --ini and php-fpm -i |
| SELinux denials | Web server cannot reach socket or files | Inspect /var/log/audit/audit.log; apply the needed booleans or contexts |
Useful journal commands—see view logs with journalctl for unit filters and follow mode:
journalctl -u php-fpmjournalctl -u httpdjournalctl -u nginxReferences
- Red Hat Enterprise Linux 10 — Installing and using dynamic programming languages
- RHEL 10.2 release notes — PHP 8.4 available
- Rocky Linux 10.2 release notes
- Rocky Linux documentation — PHP and PHP-FPM — General PHP-FPM concepts; use the RHEL 10 documentation above for native
php8.4-*AppStream package names - PHP supported versions
Summary
Native PHP 8.4 on Enterprise Linux lives in AppStream as php8.4-* RPMs in RHEL 10.2 and compatible Rocky Linux, AlmaLinux, and Oracle Linux releases; on CentOS Stream 10, confirm availability with dnf info php8.4. Install php8.4, add extensions such as php8.4-mysqlnd and php8.4-fpm, and manage the service as php-fpm—not php8.4-fpm. Apache and Nginx use the packaged FastCGI configuration against /run/php-fpm/www.sock. Use dnf upgrade 'php8.4*' for updates within PHP 8.4 and dnf remove 'php8.4*' to uninstall the full package family. To replace PHP 8.3, follow upgrade PHP 8.3 to 8.4 instead of this fresh-install guide.

