How to Install PHP 8.1 on Rocky Linux 9

To install PHP 8.1 on Rocky Linux 9, follow the steps below.

Step 1 : Ensure your system is up to date by running the following command:

Step 2 : Install the Remi repository by executing the following command:

Step 3 : Verify available PHP modules with the command:

Step 4 : Enable the Remi repository with the command:

Step 5 : Install PHP 8.1 core components:

Step 6 : Install commonly used PHP extensions:

Explanation of Extensions:

- mysqlnd: MySQL Native Driver

- curl: Client URL Library

- gd: Graphics Draw

- mcrypt: Deprecated cryptography functions

- json: JavaScript Object Notation

- pear: PHP Extension and Application Repository

- common: Common functionality

- xml: Extensible Markup Language

- zip: Zip archive handling

- devel: Development tools

- xsl: Extensible Stylesheet Language

- soap: Simple Object Access Protocol

- bcmath: Binary Calculator

- mbstring: Multibyte String

- gettext: Gettext functions

- imagick: ImageMagick PHP extension

Step 7 : Check the installed PHP version with the following command:

Congratulations! You have successfully installed PHP 8.1 on Rocky Linux 9.