How to Install PHP 8.4 on AlmaLinux / Rocky Linux

How to Install PHP 8.4 on AlmaLinux / Rocky Linux

Bitnesia Linux Mar 24, 2026 153 ID

PHP 8.4 is the latest release of the popular programming language, officially announced on November 21, 2024. This version introduces performance improvements, new syntax features, and a more efficient Just-In-Time (JIT) execution engine. According to the official PHP Supported Versions page, PHP 8.4 will receive active support until December 31, 2026, and security support until December 31, 2028. For AlmaLinux and Rocky Linux users, here’s a complete guide to installing PHP 8.4 safely and optimally.

Initial Preparation

Before starting the installation, make sure your system is up to date so all packages are on their latest versions.

sudo dnf update -y
sudo dnf install epel-release -y
/usr/bin/crb enable 

Add the Remi Repository

Next, add the Remi repository, which provides the latest PHP versions for RHEL-based systems such as AlmaLinux and Rocky Linux.

# AlmaLinux 8 / Rocky Linux 8
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y

# AlmaLinux 9 / Rocky Linux 9
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y 

The Remi repository provides multiple PHP versions, so you’ll need to enable the correct one:

sudo dnf module reset php -y
sudo dnf module enable php:remi-8.4 -y 

Install PHP 8.4

Once the module is enabled, install PHP 8.4 using:

sudo dnf install php84 php84-php-common php84-php-cli -y 

Create a symbolic link for easier command access:

sudo ln -s /usr/bin/php84 /usr/bin/php 

To verify the installation and confirm the PHP version, run:

php -v 

Example output:

PHP 8.4.14 (cli) (built: Oct 21 2025 19:23:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
Zend Engine v4.4.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.14, Copyright (c), by Zend Technologies 

If you see a similar output, PHP 8.4 has been successfully installed on your system.

Install Additional PHP Extensions

Most web applications require additional PHP extensions such as pdo, mbstring, xml, curl, or gd. Install them as needed with:

 sudo dnf install php84-php-{mysqlnd,gd,xml,mbstring,opcache,curl,zip,intl,bcmath} -y

To view all installed PHP extensions, use:

php -m 

Example output:

[PHP Modules]
bcmath      
bz2
calendar
Core
ctype
. . . 

Configure the php.ini File

The main configuration file for PHP is php.ini. You can adjust it based on your requirements — for example, to modify upload limits, execution time, or memory usage.

Edit the file using a text editor like nano or vi:

sudo nano /etc/opt/remi/php84/php.ini 

Commonly adjusted parameters include:

memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300 

Save the changes, then restart your web server to apply the configuration.

Conclusion

Installing PHP 8.4 on AlmaLinux or Rocky Linux gives you access to the latest features and performance improvements from the PHP language. With active support through 2026 and security updates until 2028, PHP 8.4 is an ideal choice for modern web applications, especially for developers who prioritize high performance, long-term stability, and compatibility.

Found this tutorial helpful? If you’d like to support my work, feel free to buy me a coffee! It helps keep the lights on and the tutorials coming.

Buy me a coffee

Related Posts