How to Install PHP 8 on CentOS 8


  1. A CentOS server set up with sudo privileges.

Getting Started

sudo yum update
sudo yum upgrade

Install Remi Repository

sudo dnf -y install
sudo dnf -y install dnf-utils
sudo dnf module list php
sudo dnf module reset php
sudo dnf module install php:remi-8.0

Install PHP 8 for HTTPD

sudo dnf install php
php -vOutput

PHP 8.0.0 (cli) (built: Nov 24 2020 17:04:03) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

Install PHP 8.0 FPM for Nginx

sudo yum install php-fpm
sudo systemctl enable php-fpm.service
sudo systemctl start php-fpm.service

Install PHP 8 Extensions

sudo dnf install php-extension_name
sudo dnf install php-{common,mysql,xml,xmlrpc,curl,gd,imagick,cli,dev,imap,mbstring,opcache,soap,zip,intl,bcmath} -y

Configure PHP 8.0

sudo nano /etc/php.ini
upload_max_filesize = 32M 
post_max_size = 48M
memory_limit = 256M
max_execution_time = 600
max_input_vars = 3000
max_input_time = 1000

Configure PHP 8 FPM Pools

sudo nano /etc/php-fpm.d/www.conf
user = username 
group = username
listen.owner = username = username

Restart PHP 8 FPM

sudo systemctl restart php-fpm.service




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store