The PHP team recently announced the official GA release of PHP 8.0.0. Usually there is a 6 months pre-release phase before the GA release of PHP 8. PHP is the most used scripting language for web development, both websites and web applications. This guide will show you how to install PHP 8.0 on CentOS 8 | CentOS 7. Please note the GA release is fit for running in Production if the application already supports it.

Below is a timetable based upon PHP 7.4 release schedule which was used in PHP 8 development.

DateRelease
Jun 25 2020Alpha 1
Jul 09 2020Alpha 2
Jul 23 2020Alpha 3
Aug 04 2020Feature freeze
Aug 06 2020Beta 1
Aug 20 2020Beta 2
Sep 03 2020Beta 3
Sep 17 2020RC 1
Oct 01 2020RC 2
Oct 15 2020RC 3
Oct 29 2020RC 4
Nov 12 2020RC 5
Nov 26 2020GA

Reference: PHP Wiki

Install PHP 8.0 on CentOS 8 | CentOS 7

We’ll use REMI repository to install PHP 8 on CentOS 8 / CentOS 7 Linux system. There are two choices for the installation.

  • Install PHP 8.0 as main PHP version
  • Install PHP 8.0 alongside other PHP versions

If you prefer to install and have PHP 8.0 as the default version then use the commands below. This means replacing base packages from the distribution with ones provided by PHP 8.0.

CentOS 8:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf -y install yum-utils
sudo dnf module reset php
sudo dnf module install php:remi-8.0 -y
sudo dnf install php -y
sudo dnf -y install php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}

CentOS 7:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --disable 'remi-php*'
sudo yum-config-manager --enable remi-php80
sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}

To install any additional PHP package use command syntax:

sudo yum install php-xxx

Check PHP version:

$ php --version
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

As this is an early release version not to be used in Production it will make sense to run PHP 8 with other PHP versions simultaneously.

Install PHP 8.0 on CentOS 8:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf -y install yum-utils
sudo dnf module reset php
sudo dnf install php80

Accept installation by pressing the y key in your keyboard:

Dependencies resolved.
==================================================================================================================================================================
 Package                                           Architecture                Version                                       Repository                      Size
==================================================================================================================================================================
Installing:
 php80                                             x86_64                      1.0-3.el8.remi                                remi-safe                      7.0 k
Installing dependencies:
 environment-modules                               x86_64                      4.1.4-4.el8                                   BaseOS                         254 k
 php80-php-cli                                     x86_64                      8.0.0~rc4-37.el8.remi                         remi-safe                      3.2 M
 php80-php-common                                  x86_64                      8.0.0~rc4-37.el8.remi                         remi-safe                      716 k
 php80-runtime                                     x86_64                      1.0-3.el8.remi                                remi-safe                      1.1 M
 policycoreutils-python-utils                      noarch                      2.9-9.el8                                     BaseOS                         251 k
 scl-utils                                         x86_64                      1:2.0.2-12.el8                                AppStream                       47 k
 tcl                                               x86_64                      1:8.6.8-2.el8                                 BaseOS                         1.1 M

Transaction Summary
==================================================================================================================================================================
Install  8 Packages

Total download size: 6.7 M
Installed size: 25 M
Is this ok [y/N]: y

Install PHP 8.0 on CentOS 7:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --disable 'remi-php*'
sudo yum-config-manager --enable remi-safe
sudo yum -y install php80 

Use the command below to install additional PHP extensions:

$ sudo yum install php80-php-xxx

Example:

sudo yum install php80-php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}

Agree to installation prompt:

..
Dependencies Resolved

==================================================================================================================================================================
 Package                                    Arch                           Version                                        Repository                         Size
==================================================================================================================================================================
Installing:
 php80-php-bcmath                           x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                          82 k
 php80-php-devel                            x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                         794 k
 php80-php-fpm                              x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                         1.8 M
 php80-php-gd                               x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                          87 k
 php80-php-mbstring                         x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                         483 k
 php80-php-mysqlnd                          x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                         193 k
 php80-php-pear                             noarch                         1:1.10.12-2.el7.remi                           remi-safe                         363 k
 php80-php-pecl-zip                         x86_64                         1.19.1-1.el7.remi                              remi-safe                          53 k
 php80-php-xml                              x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                         174 k
Installing for dependencies:
 php80-php-pdo                              x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                         127 k
 php80-php-process                          x86_64                         8.0.0~rc4-37.el7.remi                          remi-safe                          86 k

Transaction Summary
==================================================================================================================================================================
Install  9 Packages (+2 Dependent packages)

Total download size: 4.2 M
Installed size: 16 M
Is this ok [y/d/N]: y

Use below commands to check PHP 8 version and available extensions

$ php80 --version
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

$ php80 --modules

As you try PHP 8.0 share your feedback and issues encountered to the development team for feature improvements. Refer to the following pages.

PHP Web Programming Video Courses:

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here