How to install php5.6 on Kali Linux 2017.2

php5 kali linux 2017.2

Install php5.6 on Kali Linux 2017.2

 

Command
$ apt-get install apt-transport-https
$ curl https://packages.sury.org/php/apt.gpg | apt-key add –
$ echo ‘deb https://packages.sury.org/php/ stretch main’ > /etc/apt/sources.list.d/deb.sury.org.list
$ apt-get update
$ apt-get -y install php5.6 libapache2-mod-php5.6 php5.6-mysql php5.6-curl php5.6-gd php5.6-intl php-pear php-imagick php5.6-imap php5.6-mcrypt php-memcache php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-mbstring php-gettext

How to Switch PHP version (Apache):

from php5.6 to php7.0:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
from php7.0 to php5.6:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart