How to install PHP 8 in Oracle Linux with Apache?

How to install/configure PHP 8 with Apache in Oracle Linux?

I couldn't find PHP 8 related repos in Oracle Linux.

What i tried so far is:

  1. Installed PHP 8 manually by downloading tar.
  2. installed httpd from repo using sudo dnf install httpd

How to link both?

Now when I am opening a website it is showing PHP code instead of executing it.

How to configure PHP with Apache manually?

What packages should I install?


PHP 8 is available in Remi's modular repository for EL 8 in the remi-8.0 module stream.

Before you begin you will need to be using Oracle Linux 8 and have BaseOS, AppStream and EPEL repos enabled. You probably have already done this.

Install and enable remi's repositories:

dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Reset the PHP module and then enable the remi-8.0 module stream:

dnf -y module reset php
dnf -y module enable php:remi-8.0

Now install PHP normally.

For example:

dnf install httpd php

If an older version of PHP was already installed from another module stream, then updating will upgrade it to 8.0.

dnf upgrade