Install PHP 8.0 on Centos 8
PHP is a popular general-purpose scripting language that is especially suited to web development.There are many frameworks that are also built with PHP, like WordPress, Codeigniter, Laravel, etc.
php 8.0 is released recently with many new features with numerous improvements and new features such as attributes, match expressions,Just-In-Time compilation (JIT),union types and much more. This article guides you how to install php8 on centos 8 server.
Also Read -> How to Install PHP 7.4 on Centos 8
Step 1: update packages
Make sure that your centos server having latest packages installed.
dnf update
Step 2: Install Remi repo
PHP 8 is recently released so it is not available in the default repositories and you need to install Remi repository.
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Then list the available PHP module streams.
dnf module list php
output:
Extra Packages for Enterprise Linux Modular 8 - x86_64 14 kB/s | 98 kB 00:06
Extra Packages for Enterprise Linux 8 - x86_64 420 kB/s | 8.4 MB 00:20
Remi's Modular repository for Enterprise Linux 8 - x86_64 120 kB/s | 700 kB 00:05
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 244 kB/s | 1.6 MB 00:06
Last metadata expiration check: 0:00:02 ago on Sat 05 Dec 2020 02:21:41 AM EST.
CentOS-8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Now you can reset the module and enable PHP 8.0 with following commands.
sudo dnf module reset php
sudo dnf module enable php:remi-8.0
Also Read -> How to Install JAVA 13 on Centos 8
Step 3: Install php
you can install PHP 8.0 as shown below.
sudo dnf install php
once php is installed, you can check version
php -v
output:
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
Then you can install required php extensions
dnf install php-{common,mysqlnd,xml,xmlrpc,curl,gd,imagick,cli,imap,mbstring,opcache,soap,zip,intl,bcmath}
That's it.Now you have learned how to install php 8.0 on Centos 8 server.
Also Read -> How to Install Apache Maven on Centos 8