To install PHP 8.4 on AlmaLinux 9 for Nginx, follow the steps below:
Step 1 : Update System
Before installing PHP, ensure your system is up to date:

Step 2 : Import PHP Remi Repository
PHP 8.4 is available through the Remi repository. Install it with:

Step 3 : Check Available PHP Modules
List the available PHP versions using:

Step 4 : Enable PHP 8.4 from Remi Repository
Enable the PHP 8.4 module:

Step 5 : Install PHP Core
Install PHP and its core components:

Step 6 : Install Common PHP Extensions
To ensure proper functionality, install commonly used extensions:

- php-fpm – FastCGI Process Manager, required for Nginx.
- php-cli – Allows running PHP scripts via the command line.
- php-mysqlnd – MySQL Native Driver for PHP.
- php-curl – Enables PHP to send HTTP requests.
- php-gd – Image processing extension.
- php-mcrypt – Encryption and decryption functionality.
- php-json – JSON data handling.
- php-xml – XML processing.
- php-zip – Zip archive support.
- php-bcmath – Arbitrary precision mathematics.
- php-mbstring – Multi-byte string handling.
- php-gettext – Translation support for internationalization.
- php-imagick – Image processing via ImageMagick.
Step 7 : Configure PHP-FPM for Nginx
Edit the PHP-FPM configuration file:
Find the following lines and change apache to nginx:

Save and exit (CTRL+X, then Y and Enter).
Step 8 : Enable and Start PHP-FPM

Step 9 : Verify PHP Installation
Check the installed PHP version:

Step 10 : Configure Nginx to Use PHP
Edit the Nginx configuration for your domain:
Add the following block inside the server block:

Save and exit.
Step 11 : Test Nginx Configuration
Check for syntax errors:

Step 12 : Restart Nginx
Apply the changes by restarting Nginx:

Step 13 : Test PHP
Create an info.php file in your website's root directory:

Step 14 : Access PHP Info Page
Open your browser and visit:

If you see the PHP information page, PHP is successfully configured.
Congratulations! You have successfully installed and configured PHP 8.4 with Nginx on AlmaLinux 9.