Install PHP 8.4 on Rocky Linux, RHEL, AlmaLinux, and Oracle Linux

Install PHP 8.4 from native AppStream php8.4-* packages on RHEL 10.2+, Rocky Linux, AlmaLinux, Oracle Linux, or CentOS Stream 10 when dnf info php8.4 confirms availability, then configure php-fpm and verify Apache or Nginx integration.

Published

Updated

Read time 10 min read

Reviewed byDeepak Prasad

Install PHP 8.4 on Rocky Linux and Enterprise Linux banner with PHP logo and terminal motif
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.

IMPORTANT
Native 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.
NOTE
If 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.4 confirms 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.4 reports 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:

bash
cat /etc/os-release

Sample output:

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:

bash
dnf repolist --enabled

Sample output:

output
repo id                         repo name
appstream                       Rocky Linux 10 - AppStream
baseos                          Rocky Linux 10 - BaseOS
extras                          Rocky Linux 10 - Extras

Look up the meta package:

bash
dnf info php8.4

Sample output:

output
Available Packages
Name         : php8.4
Version      : 8.4.21
Release      : 1.el10_2
Repository   : appstream
Summary      : PHP scripting language for creating dynamic web sites

If 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:

bash
php -v

If 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:

bash
sudo dnf install php8.4

DNF pulls in php8.4-cli, php8.4-common, and dependencies. The CLI binary remains /usr/bin/php.

Verify the version:

bash
php -v

Sample output:

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 Technologies

See which configuration files apply:

bash
php --ini

Sample output:

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:

bash
sudo dnf install php8.4-mysqlnd php8.4-mbstring php8.4-xml php8.4-gd php8.4-intl php8.4-opcache

List available extension packages:

bash
dnf list available 'php8.4-*'

Confirm modules load in the CLI:

bash
php -m

You 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:

bash
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:

bash
sudo dnf install php8.4-fpm

Keep the naming straight:

text
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:

bash
sudo systemctl enable --now php-fpm

Check that the unit is active:

bash
systemctl status php-fpm

Sample output:

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:

bash
php-fpm -t

Sample output:

output
[22-Jul-2026 07:05:28] NOTICE: configuration file /etc/php-fpm.conf test is successful

The default www pool listens on a Unix socket. Match the exact listen = assignment—not other listen.* directives such as ACL settings:

bash
grep -E '^[[:space:]]*listen[[:space:]]*=' /etc/php-fpm.d/www.conf

Sample output:

output
listen = /run/php-fpm/www.sock

The 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:

bash
sudo dnf install httpd

EL10 ships FastCGI handling in /etc/httpd/conf.d/php.conf. Start both services:

bash
sudo systemctl enable --now httpd php-fpm

Create a small test script under the Apache document root:

bash
echo '<?php echo "PHP " . PHP_VERSION . " via " . php_sapi_name(); ?>' | sudo tee /var/www/html/test.php

Request it locally with curl command:

bash
curl -s http://127.0.0.1/test.php

Sample output:

output
PHP 8.4.21 via fpm-fcgi

Remove the test file when you are done: sudo rm /var/www/html/test.php.

Nginx

Install Nginx:

bash
sudo dnf install nginx

The 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.

bash
echo '<?php echo "PHP " . PHP_VERSION . " via " . php_sapi_name(); ?>' | sudo tee /usr/share/nginx/html/test.php

Start PHP-FPM and Nginx:

bash
sudo systemctl enable --now php-fpm nginx

Test:

bash
curl -s http://127.0.0.1/test.php

Sample output:

output
PHP 8.4.21 via fpm-fcgi

Delete 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:

bash
php -v

Configuration paths:

bash
php --ini

Loaded modules:

bash
php -m

FPM build and SAPI:

bash
php-fpm -i | grep -E '^(PHP Version|Server API|Loaded Configuration File)'

Sample output:

output
PHP Version => 8.4.21
Server API => FPM/FastCGI
Loaded Configuration File => /etc/php.ini

Service state:

bash
systemctl status php-fpm

Pool syntax check:

bash
php-fpm -t

A successful installation should show:

  • php -v reporting PHP 8.4.x
  • Expected extensions in php -m
  • php-fpm.service in active (running) state
  • php-fpm -t reporting a successful configuration test
  • A web-server curl test returning PHP 8.4 through fpm-fcgi when Apache or Nginx is configured

Confirm php-fpm remains enabled after reboot:

bash
systemctl is-enabled php-fpm

Update 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.

bash
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:

bash
sudo systemctl restart php-fpm
php -v

This 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:

bash
sudo systemctl disable --now php-fpm

Preview removal of every installed php8.4-* package:

bash
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:

bash
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:

bash
php -v

Sample output when the CLI package is gone:

output
bash: php: command not found
bash
rpm -q php8.4

Sample output:

output
package php8.4 is not installed

DNF 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:

bash
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:

bash
journalctl -u php-fpm
bash
journalctl -u httpd
bash
journalctl -u nginx

References


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.


Frequently Asked Questions

1. Which Enterprise Linux release includes PHP 8.4 in the default repositories?

Native php8.4-* packages ship in RHEL 10.2 and compatible Rocky Linux, AlmaLinux, and Oracle Linux releases. EL 10.0 and 10.1 AppStream do not publish that set—upgrade the OS minor release or use containers or a third-party repository. On CentOS Stream 10, run dnf info php8.4 because package availability, not a 10.2 point-release value, is the deciding test.

2. Why does dnf install php8.4-fpm but systemctl start php8.4-fpm fail?

The RPM is named php8.4-fpm, but the systemd unit is php-fpm.service and the binary is /usr/sbin/php-fpm. Run sudo systemctl enable --now php-fpm and php-fpm -t to validate configuration.

3. Can I run PHP 8.3 and PHP 8.4 together with native EL 10 packages?

No. Native php8.4-* RPMs do not provide parallel /usr/bin/php commands or separate php-fpm services. Use the upgrade guide to replace PHP 8.3, or run each version in its own container or VM.

4. How do I upgrade PHP 8.3 to PHP 8.4 on Rocky Linux 10?

Follow the dedicated upgrade PHP 8.3 to 8.4 guide for Enterprise Linux—this install article covers fresh installation only.

5. Does this guide cover Ubuntu or Debian PHP installation?

No. Debian and Ubuntu use different package names, service layout, and configuration paths. Use a Debian-family PHP guide for apt-based systems.
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on …