Miscellaneouss

How to Install PHP 7.2, 7.1 and 5.6 on Debian 9 Stretch System

PHP is the scripting language which is used to generate dynamic web page. It contain TEXT,HTML and SCRIPT BLOCKS. Whenever user request for a PHP page through web browser than PHP script execute on web server and display the requested result in browser.

PHP 7.1 is the latest stable release version of PHP. It was released on December 3, 2015. It provides 2x faster performance and 50% better memory consumption than PHP version 5.6.

First of all you need to complete the he prerequisites step and then go forward for installing PHP version of your choice or requirements.

Prerequisites

Follow the below command to install the required packages first on your system. Then import packages signing key. After that configure PPA for the PHP packages on your system.

$ sudo apt install ca-certificates apt-transport-https 
$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
$ sudo echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list

Now follow the below options to install PHP.

Install PHP 5.6

Follow the below command to install the PHP 5.6 on your Debian 9 stretch system.

$ sudo apt update
$ sudo apt install php5.6

You can also install required PHP modules using below command.

$ sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-gd php5.6-json php5.6-mbstring php5.6-mysql php5.6-xml

Install PHP 7.2

Follow the below command to install PHP 7.2 on your Debian 9 stretch system.

$ sudo apt update
$ sudo apt install php7.2

You can also install required PHP modules using below command.

$ sudo apt install php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-xml

Install PHP 7.1

If you application has specific requirement of PHP 7.1, You can yuse the following commands for installing PHP 7.1 on your Debian 9 Stretch system.

$ sudo apt update
$ sudo apt install php7.1

You can also install required PHP modules using below command.

$ sudo apt install php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-xml
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

2 Comments

Leave a Comment