installphp.info


← Back to home page

Install PHP 7.0 on Debian 12

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 12

Prerequisites

  • Debian 12 (Bookworm) installed and updated
  • Root access or sudo privileges
  • Terminal access
  • Internet connection

Installation

  1. Update the package list:

    sudo apt update
  2. Install software-properties-common:

    sudo apt install software-properties-common
  3. Add the PHP repository:

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

    sudo apt update
  5. Install PHP 7.0:

    sudo apt install php7.0

Verification

  1. Check the installed PHP version:

    php -v
  2. Verify PHP configuration:

    php -i
  3. Create a test PHP file:

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

    http://your_server_ip/phpinfo.php