To install PHP 8.4 for Apache on AlmaLinux 9, follow these simple steps:
Step 1 : Start by updating the system to ensure all packages are up to date. Run the following command:
Step 2 : Next, you need to import the Remi repository, which provides the latest PHP versions. Run this command:
Step 3 : Before enabling the PHP version, check the list of available PHP modules to ensure they are correctly loaded:
Step 4 : Enable the Remi repository for PHP 8.4 by running:
Step 5 : Now, install PHP 8.4 by using the following command:
Step 6 : To install commonly used PHP extensions, run this command:
- cli: Command Line Interface for PHP.
- mysqlnd: MySQL Native Driver for better performance.
- curl: Allows PHP to interact with remote servers via URLs.
- gd: For image processing functions.
- mcrypt: Encryption functions (deprecated but still used in some older applications).
- json: JSON support for PHP.
- pear: Package for PHP to extend functionality.
- common: Common PHP files for the web.
- xml: Support for XML parsing.
- zip: For zip file compression.
- devel: Development libraries.
- xsl: Extensible Stylesheet Language (XSLT) support.
- soap: SOAP Web Services support.
- bcmath: For arbitrary precision mathematics.
- mbstring: Multibyte string support.
- gettext: Localization and internationalization.
- imagick: Image manipulation extension.
Step 7 : Check the PHP version to verify the installation:
Step 8 : After installing PHP, restart Apache to apply the changes:
Step 9 : Create a test PHP file to verify the PHP installation. Run:
Step 10 : Now, open your browser and navigate to your domain to see the PHP info page:
Congratulations! You have successfully installed PHP 8.4 for Apache on AlmaLinux 9.