How to Install PHP 7.4 on Rocky Linux 9

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

Step 1 : Begin by updating your system using the following command:

Step 2 : Import the PHP Remi repository by executing the following command:

Step 3 : Verify available PHP modules with the command:

Step 4 : Enable the PHP Remi repository using the command:

Step 5 : Install PHP core components

Step 6 : Install commonly used PHP Extensions

  • mysqlnd: MySQL native driver for enhanced database connectivity.
  • curl: Enables PHP to communicate with various protocols, including HTTP.
  • gd: Supports image creation and manipulation functions.
  • mcrypt: Provides cryptographic functions.
  • json: Handles JSON data.
  • pear: PHP Extension and Application Repository.
  • common: Shared files and scripts for PHP packages.
  • xml: Handles XML data.
  • zip: Adds support for ZIP archive handling.
  • devel: Development files for building PHP extensions.
  • xsl: Supports XSLT transformations.
  • soap: Implements Simple Object Access Protocol (SOAP) support.
  • bcmath: Offers arbitrary precision mathematics.
  • mbstring: Handles multibyte string functions.
  • gettext: Enables internationalization functions.
  • imagick: Adds image processing capabilities.

Step 7 : Check the installed PHP version using:

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