How to Install PHP 7.4 with Nginx in RHEL 8

How to Install PHP 7.4 with Nginx in RHEL 8 - Hi everyone, Back at, this time I will write and share my experience in the linux world, in this article I will discuss how to install PHP with Version 7.4.

The installation method is quite simple, it only takes a few steps.


For the first step you must install the epel repo, for the command can be seen below :

# dnf install
# dnf install dnf-utils

Install Epel Repo
Install Epel Repo

You just have to activate the epel repo to 7.4 so that later when you install php, what is installed on your server is version 7.4.

# dnf module list php
# dnf module list reset php -y
# dnf module enable php:remi-7.4
Activated remi php 7.4
Activated remi php 7.4

After installing the epel repo, you can proceed to the install section.


Keep in mind because I'm an nginx user I installed php which needs nginx, namely php-cli, if you are an apache user you can just install php.

In the command below I immediately installed php and the modules that I usually use.

# dnf install php-cli php-pear php-devel php-fpm php-curl php-mysqlnd php-gd php-opcache php-zip php-intl php-common php-bcmath php-imap php-imagick php-xmlrpc php-json php-readline php-memcached php-redis php-mbstring php-apcu php-xml php-devel -y

Proses Install PHP dan Module
Proses Install PHP dan Module

You can see with the version check command to make sure php has been installed on our server.

Check Version of PHP
Check Version of PHP


Basically php will run with the root user, because I want to change the php to run as the nginx user I change to nginx for the method as below;

Before change to Nginx
Before change to Nginx
# vi /etc/php-fpm.d/www.conf

; RPM: apache user chosen to provide access to the same directories as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

# systemctl restart nginx
# systemctl restart php-fpm

After change to Nginx
After change to Nginx

And that's my experience when I installed PHP 7.4 with nginx on RHEL 8. I hope this article can be useful for all of you.

That is all and thank you.

Bangkit Ade Saputra
Bangkit Ade Saputra At the end of the day, my job involves people. we're complicated, we're always changing, we have millions of things going on in our lives, and changing jobs is always a big decision.

Post a Comment for "How to Install PHP 7.4 with Nginx in RHEL 8"