How to install PHP 7 on Debian Linux 8.x/7.x [jessie/wheezy]

To install PHP 7 on Debian Linux 8.x/7.x (jessie/wheezy), follow these steps:

  1. Add the package repository for PHP 7:
sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
  1. Update the package list:
sudo apt-get update
  1. Install PHP 7 and related modules:
sudo apt-get install php7.0 php7.0-fpm php7.0-common php7.0-cli php7.0-mysql php7.0-mbstring
  1. Verify the installation by checking the version:
php -v

This should output the version of PHP that you have installed on your system.

Leave a Comment