installphp.info


← Back to home page

Install PHP 7.0 on Debian 10

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 Debian 10

Prerequisites

  • A Debian 10 (Buster) system with root or sudo access
  • Terminal access to the system
  • Internet connection for downloading packages

Installation

  1. Update the package list:

    sudo apt update
  2. Install the required packages:

    sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common
  3. Add the Ondřej Surý PHP repository:

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

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

    sudo apt install -y php7.0 php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-xml

Verification

  1. Check the 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 installed modules:

    php -m

    This will list all installed PHP modules.

  3. Create a test PHP file:

    echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/phpinfo.php
  4. Access the phpinfo file through your web browser:

    http://your_server_ip/phpinfo.php

    This will display detailed information about your PHP installation.