How to Install PHP 8.0 on CentOS 7 and 8

How to Install PHP 8.0 on CentOS 7 and 8

PHP is one of the most popular server-side scripting languages used all over the world. It is widely used in developing dynamic web pages. The latest version of Install PHP on CentOS 8.0 offers a lot of optimization and improvement in PHP code.

It plays a major and important role from both the sides Frontend(Website) and Backend(Server).In this tutorial, we will learn how to install PHP 8.0 in CentOS 7 and 8.

Read Also: How To Install Plesk Control Panel On Ubuntu 20.04?

PHP Modules

We can say PHP Modules and PHP extensions both are the same thing and refer to the same. These extensions or modules create the configuration between different packages.

intl
mbstring
gd
mysqlnd
xml
ldap
mysqli
curl
imap
zip
json
opcache

Enable Remi Repository

To install PHP 8.0 first we need to enable the necessary repository. Repositories store the package’s version by version that is helpful to install required packages and its dependencies altogether.

  • Follow the below command according to your preferred Operating System.

CentOS 7

yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm

CentOS 8

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

Install PHP 8.0 on CentOS

  • To install the PHP 8.0, follow the below command. This below command will install PHP 8.0 with some important extensions.
sudo yum install php80 php80-php-intl php80-php-mbstring php80-php-gd php80-php-xml php80-php-imap php80-php-zip php80-php-curl php80-php-json php80-php-ldap php80-php-mysqlnd php80-php-opcache -y
  • Run the below command To check the PHP 8.0 installation.
php -v

If it shows an error that the command was not found then you need to set the default PHP version to PHP8.0 with the following command.

scl enable php80 bash
  • To check the Installed PHP modules
php -m
  • To you have installed multiple PHP version on the server. You can easily check the installed PHP versions with their modules just simply run the following command.
yum list installed | grep php

Conclusion

In this tutorial, we have learned how to install the latest PHP 8.0 in CentOS 7 and 8 with PHP modules. PHP plays a major and important role from both the sides Frontend(Website) and Backend(Server).

If you guys have any queries related to this tutorial then let me know in the comments.