Friday 31 December 2021

How to Install PHP 8.1 on CentOS 8



PHP is free and open source programming language. It is widely used Linux based system to write application. The latest PHP packages are not available in CentOS 8 AppSteam repository.
 
This article describes How to Install PHP 8.1 on CentOS 8 .
 
[root@linuxcnf ~]# cat /etc/redhat-release
CentOS Linux release 8.5.2111
[root@linuxcnf ~]#
 
Step 1. Setup EPEL Repository: Follow the article How to configure EPEL repository on CentOS 8 to setup EPEL Repository.
 
Step 2. Setup REMI Repository: Follow the article How to Install REMI Repository on CentOS 8 to setup REMI Repository.
 
Step 3. Enable Remi Repository for PHP Installation: Run the following command to enable REMI Repository for PHP 8.1 installation:
 
[root@linuxcnf ~]# dnf module enable php:remi-8.1
……………………..
Enabling module streams:
 php                                remi-8.1
 
Transaction Summary
=======================================================
 
Is this ok [y/N]: y
Complete!
[root@linuxcnf ~]#
 
Step 4. PHP 8.1 Installation: Run the following command to install PHP 8.1:
 
[root@linuxcnf ~]# dnf install php -y
……………………..
  php-8.1.1-1.el8.remi.x86_64
  php-cli-8.1.1-1.el8.remi.x86_64
  php-common-8.1.1-1.el8.remi.x86_64
  php-fpm-8.1.1-1.el8.remi.x86_64
  php-mbstring-8.1.1-1.el8.remi.x86_64
  php-opcache-8.1.1-1.el8.remi.x86_64
  php-pdo-8.1.1-1.el8.remi.x86_64
  php-sodium-8.1.1-1.el8.remi.x86_64
  php-xml-8.1.1-1.el8.remi.x86_64
 
Complete!
[root@linuxcnf ~]#
 
Step 5. Validate PHP Installation: Run the following command to validate/verify PHP 8.1 installation:
 
[root@linuxcnf ~]# php -v
PHP 8.1.1 (cli) (built: Dec 15 2021 02:00:45) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
[root@linuxcnf ~]#
 
Done!!! PHP 8.1 is successfully installed on CentOS 8.

1 comment: