TrinityTuts

Steps to install PHP 8.0 on Ubuntu and its Features

Last updated on November 18th, 2022 at 10:02 am

PHP 8.0 is released on November 26, 2020. You can download PHP 8.0 from php.net. It’s a new major version, which means it will have some breaking change and lots of new features and performance improvement. Due to breaking change, you need to update your code to run on the latest version of PHP 8.0.

PHP 8.0 will come with some new features such as the JIT compiler, union types, attributes, and more.

List of New Feature in PHP 8.0

  1. Named Arguments
  2. Attributes
  3. Constructor property promotion
  4. Union types
  5. Match expression
  6. Nullsafe operator
  7. Saner string to number comparisons
  8. Consistent type errors for internal functions
  9. JIT (Just in time compiler)

Now before I start explaining to you all the above new features in detail first we need to install the latest PHP version 8.0.

Installation of PHP 8.0 Ubuntu

We need to add ondrej/php PPA as a source of packages, that contains all the latest PHP packages and their dependencies.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

To install PHP 8.0 extensions you need to run this command

sudo apt install php8.0-common php8.0-cli -y

This command will install several PHP extensions due to php8.0-common, and the CLI for PHP 8.0.

You can check PHP Version by running this command PHP -v. To install PHP fpm run the bellow command

sudo apt install php8.0-fpm

Now with the help of the above command, your PHP 8.0 is installed successfully now you can write your code and test the latest feature of PHP 8.