installphp.info


← Back to home page

Install PHP 8.0 on Ubuntu 20.04

Warning! This PHP version is end-of-life!

PHP 8.0 reached end of life on 26 Nov 2023 and is no longer being updated. It's strongly recommended to upgrade to the latest version as soon as possible. You can read the official PHP migration guide here.

Installing PHP 8.0 on Ubuntu 20.04

Prerequisites

  • Ubuntu 20.04 LTS installed
  • Root or sudo access
  • Terminal access
  • Internet connection

Installation

  1. Update the package list:

    sudo apt update
  2. Add the PHP 8.0 PPA:

    sudo add-apt-repository ppa:ondrej/php
  3. Install PHP 8.0:

    sudo apt install php8.0
  4. Install common PHP extensions:

    sudo apt install php8.0-common php8.0-mysql php8.0-xml php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip php8.0-intl

Verification

  1. Check the PHP version:

    php -v

    You should see output indicating PHP 8.0.x is installed.

  2. Verify PHP configuration:

    php -i

    This will display detailed PHP configuration information.

  3. Check installed modules:

    php -m

    This will list all installed PHP modules.