How To Install PHP 8.0 on CentOS 7 / RHEL 7


PHP is a widely-used open-source programming language to create dynamic websites such as blogs, forums, e-commerce, etc. It was originally created by Rasmus Lerdorf in 1994.

CentOS 7 comes with PHP 5.x by default, which is already the end of life.

In this post, we will see how to install PHP 8.0 on CentOS 7 / RHEL 7.

If you are looking for an article about installing PHP 7.x on CentOS 7 / RHEL 7, click this link.

Install PHP 8.0 On CentOS 7 / RHEL 7

Add Remi Repository

Remi is a third-party repository that provides the latest PHP rpm packages for RHEL / CentOS.

To enable the Remi repository, install the Remi repository auto-configuration package.

yum install -y

yum install -y

Install PHP 8.0

Use the below command to install PHP 8.0 package by temporarily enabling the Remi PHP 8.0 repository.

yum install -y --enablerepo=remi-php80 php php-cli


Enable Remi PHP 8.0 repository permanently with yum-config-manager command and then install PHP v8.0.

yum install -y yum-utils

yum-config-manager --enable remi-php80

yum install -y php php-cli

Check PHP Version

Once you have installed the PHP package, check the PHP version with the following 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

Install PHP Extensions

PHP extensions are compiled libraries that enable support for your code. For example, installing PHP MySQL extension will enable your PHP code to connect with the MySQL database.

PHP extensions package is normally named like php-<extn_name>.

To install MySQL support, you can install the php-mysqlnd package.

yum install -y --enablerepo=remi-php80 php-mysqlnd


yum install -y php-mysqlnd

Once you have installed a particular extension, you can use the below command to verify it.

php -m | grep -i mysql




That’s All. Please share your feedback in the comments section.

You might also like