installphp.info


← Back to home page

Install PHP 7.0 on Ubuntu 22.04

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

PHP 7.0 reached end of life on 03 Dec 2018 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 7.0 on Ubuntu 22.04

Prerequisites

  • Ubuntu 22.04 LTS installed
  • Root or sudo access to the system
  • Terminal access
  • Internet connection

Installation

  1. Add the PHP 7.0 PPA repository:

    sudo add-apt-repository ppa:ondrej/php
  2. Update the package list:

    sudo apt update
  3. Install PHP 7.0 and common extensions:

    sudo apt install php7.0 php7.0-cli php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-mbstring php7.0-xml

Verification

  1. Check the installed PHP version:

    php -v

    You should see output similar to:

    PHP 7.0.33-0ubuntu0.16.04.16 (cli) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
  2. Verify PHP-FPM is running:

    sudo systemctl status php7.0-fpm

    You should see output indicating that the service is active and running.

  3. Check installed PHP modules:

    php -m

    This will list all installed PHP modules.