How To Install PHP 8.1 on CentOS 7

How To Install PHP 8.1 on CentOS 7

12,416

This is a short guide on how to Install PHP 8.1 on CentOS 7 Linux system.


If you're looking for PHP 7.4 visit here.


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.


Step 1: Add EPEL and REMI Repository

Run the commands below to add required repositories.

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Step 2: Install PHP 8.1 on CentOS 7

We can now enable PHP 7.4 Remi repository and install PHP 7.4 on CentOS 7.

yum -y install yum-utils
yum-config-manager --enable remi-php81

Install PHP 7.4 on CentOS 7.

yum update
yum install php php-cli

Accept installation prompt by typing y and hit enter

Use the next command to install additional packages:

yum install php-xxx

// Example

yum install php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

The current PHP version should be 8.1.

php -v

Now you have PHP 8.1

- Last updated 2 years ago

Ads

Be the first to leave a comment.

You must login to leave a comment