How to instructions for installing PHP 8.1 on CentOS 9 Stream
What is PHP?
PHP: Hypertext Preprocessor, commonly abbreviated to PHP, is a scripting language or type of code preeminent used to develop general-purpose, open-source, server-written applications. It is very suitable for the web and can be easily embedded into HTML pages. Because it is optimized for web applications, is fast, compact, has a syntax similar to C and Java, is easy to learn, and has a relatively shorter product build time compared to other languages, PHP has quickly become one of the most popular languages in the world. The world’s most popular web programming language.
PHP 8.1 is currently under development and will be released on November 25, 2021. With PHP 8.1 it will be the most powerful content management on major and popular platforms like Joomla, Drupal, WordPress, OpenCart, Magento, and OctoberCMS, in addition, PHP 8.1 comes with a host of new features and improvements. Right now, I will introduce some new outstanding features and show you how to install PHP 8.1 on CentOS 7 to start exploring its cool features more closely.
What’s New in PHP 8.1?
- Enums have been integrated
- Readonly properties (Class properties can be marked as read-only and thus can only be written once.
- Never keyword (A new return type hint named Never was added in PHP 8.1)
- DNS over HTTPS (DoH) support.
- Support AVIF Image format.
- Added support for Fibers (Low-level mechanism for parallel management).
- The PHP Curl extension now supports HTTP(S) requests with File upload.
- Support for new fdatasync() and fsync() functions.
- PHP 8.1 adds array_is_list as a built-in function .
- Speed efficiency improved from 5% to 8% compared to the old version
- Unpack the array using string keys.
Install PHP 8.1 on CentOS 9
Since the default YUM repository in CentOS 9 does not have PHP 8.1 packages available, we will use the REMI repository to install 8.1 on CentOS 9
Step 1: SSH into the server
To install PHP 8.1 on CentOS 9, the first thing we need to do is SSH or access your VPS or server with root privileges first.
After successfully SSH, we continue with step 2.
Step 2: Install PHP 8.1 on CentOS 9
To get started, you need to add the Remi repository first so that from there you will be able to install PHP 8.1 on CentOS 9.
To install and activate the Remi repository on CentOS 9, you need to run the following commands:
yum install epel-release && yum install remi-release
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
Below is the output after running the above commands.
- To install the PHP 8.1 packages and activate them permanently, you need to run the following commands:
dnf module list php dnf module enable php:remi-8.1 -y
dnf install php-fpm php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-mysqlnd php-pdo php-soap php-tidy php-xml php-xmlrpc php-opcache php-redis php-pecl-mcrypt php-brotli
Below is the output after running the above commands
Step 3: Check PHP version after installation
After you have installed it, you can check the PHP version again with the following command:
Below is the output after running the above command
As shown, I have successfully installed PHP 8.1 on CentOS 9 successfully.
So in this article, I showed you how to install PHP 8.1 on CentOS 9 stream in a very simple and fast way. PHP 8.1 will certainly bring many new utilities, thus helping applications or websites to operate with maximum efficiency and stability. Hope the article will help you, wish you success.