Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install PHP 8 on CentOS 8 - DesignLinux

designlinux 0 Comments

PHP is a most popular server scripting language used for creating dynamic and interactive Web pages. Recently PHP 8 has been released officially. This tutorial explains how to install PHP 8 on CentOS 8 system.

PHP 8.0 is the latest major release and includes performance improvements, and lots of new features such as named arguments, JIT compiler, union types, match expression, and more. We’ll use REMI repository to install PHP 8.

Prerequisites#

You must logged in with root or user with sudo privileges.

Install PHP 8 on CentOS 8#

Perform the following steps to install PHP 8 on CentOS system.

Step 1 – Update System#

Use the following command to update your CentOS 8 / RHEL 8 system.

sudo dnf update
sudo dnf upgrade

Once the updates applied, you can reboot your system using below command. It’s an optional to reboot.

sudo reboot

Step 2 – Enable EPEL & Remi Repository#

By default, CentOS 8 package repositories doesn’t includes PHP 8. So, we have to enable EPEL and remi repositories. Run following commands to enable:

sudo dnf install -y epel-release
sudo dnf install -y  http://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf install -y dnf-utils

Step 3 – Install PHP 8#

Run the following commands to reset PHP module and install PHP 8 from remi-8.0 module.

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

Step 4 – Verify Installation#

You can verify the installation using --version command:

php -v
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

By default, Nginx doesn’t have a built-in support for processing PHP files. So we need to use PHP FPM service to handle the PHP files.

sudo dnf install -y php-fpm

You must start and enable its services once the php-fpm package is installed. Run following command:

sudo systemctl enable php-fpm --now

To verify the status of php-fpm service, run:

systemctl status php-fpm

Installing PHP Extensions#

You can install PHP extensions as per requirements. You can easily install extensions using dnf package manager in following form:

sudo dnf install -y php-[extension]

For example, to install curl and mbstring extensions, you would run the following command:

sudo dnf install -y php-{curl,mbstring}

You must restart the Apache or PHP FPM service after installing extensions.

Conclusion#

I hope you successfully learned how to install PHP 8 on CentOS 8 / RHEL 8 system.

If you have any questions or feedback, please leave a comment below.

Related

Tags: centos, php

Bash wait Command

Prev Post

How to Install Webmin on Fedora Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 580
  • 1,055,352

DesignLinux.com © All rights reserved

Go to mobile version