lunes, 12 de febrero de 2018

How to Install PHP 7.1 & 7.0 on Debian 8 Jessie

Written by  | February 9, 2017 | Updated December 1, 2017

Firstly say thanks to dotdeb.org for maintaining the packages of PHP from many years. But it looks they are dropping this. PHP 7.0 is last available version on there. To install PHP 7.1 we will use sury.org Debian repository. This article will help you to install PHP 7.1, 7.0 and 5.6 on Debian 8 Jessie systems using PPA.

Install PHP 7.0 on Debian 8

Firstly you need to add Dotdeb PPA on your system. Before adding PPA first import the GPG key of Dotdeb repository.
sudo apt install curl
curl https://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -
Now use the following commands to add PPA in your system.
echo 'deb http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list
echo 'deb-src http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list
Use the following set of commands to update PPA for PHP 7.0 in your Debian system and install it.
sudo apt update
sudo apt install php7.0
Now use the following command to check installed php version on your system.
php -v 

PHP 7.0.20-1~dotdeb+8.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.20-1~dotdeb+8.1, Copyright (c) 1999-2017, by Zend Technologies

Install PHP 7.1 on Debian 8

Firstly you need to add Dotdeb PPA on your system. Before adding PPA first import the GPG key of Dotdeb repository.
apt install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Now use the following commands to add PPA in your system.
echo "deb https://packages.sury.org/php/ jessie main" > /etc/apt/sources.list.d/php.list
Use the following set of commands to update PPA for PHP 7.0 in your Debian system and install it.
sudo apt update
sudo apt install php7.1
Now use the following command to check installed php version on your system.
php -v 

PHP 7.1.6-2+0~20170614060700.1+jessie~1.gbp831871 (cli) (built: Jun 14 2017 06:28:54) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.6-2+0~20170614060700.1+jessie~1.gbp831871, Copyright (c) 1999-2017, by Zend Technologies

Install PHP 5.6 on Debian 8

PHP 5.6 packages are already available under Debian 8 default repositories. Use the following set of commands to install PHP 5.6 in your Debian system.
sudo apt-get update
sudo apt-get install php5
Now use the following command to check installed php version on your system.
php -v 

PHP 5.6.29-0+deb8u1 (cli) (built: Dec 13 2016 16:02:08)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Congratulation! Enjoy the development with PHP 7.1, PHP 7.0 or PHP 5.6 on Debian 8 Jessie system

No hay comentarios:

Publicar un comentario