How to Install PHP 8.2 for Apache on Rocky Linux 9

To install PHP 8.2 for Apache on Rocky Linux 9, follow the steps below.

Step 1 : Update your system to ensure that you have the latest package information.

Step 2 : Download and install the Remi repository, which provides newer PHP versions.

Step 3 : Check available PHP modules

List available PHP modules to ensure compatibility.

Step 4 : Enable the PHP Remi repository to access the desired PHP version.

Step 5 : Install PHP 8.2.

Step 6 : Install commonly used PHP Extensions

Explanation of Extensions:

  • cli: Command Line Interface
  • mysqlnd: MySQL Native Driver
  • curl: Client URL Library
  • gd: Graphics Draw
  • mcrypt: Encryption Extension (deprecated in PHP 7.1)
  • json: JavaScript Object Notation
  • pear: PHP Extension and Application Repository
  • common: Common functionality
  • xml: eXtensible Markup Language
  • zip: Compression and Archive Extension
  • devel: Development files for PHP
  • xsl: XSLT Transformation
  • soap: Simple Object Access Protocol
  • bcmath: Arbitrary Precision Mathematics
  • mbstring: Multibyte String
  • gettext: Gettext
  • imagick: ImageMagick PHP extension

Step 7 : Verify PHP version

Step 8 : Restart Apache Restart Apache to apply the changes:

Step 9 : Create a simple PHP file for testing purposes.

Step 10 : Check results by visiting the domain's info.php page.

Step 11 : Open a web browser and navigate to http://your_domain_or_ip/info.php to view PHP information.

Congratulations! You have successfully installed PHP 8.2 for Apache on Rocky Linux 9.