Instalar PHP en Linux

Instalar PHP 7

apt-get -y update
add-apt-repository ppa:ondrej/php
apt-get -y update
apt-get install -y php7.0
apt-get install -y php7.0-common
apt-get install -y php7.0-gd
apt-get install -y php7.0-mysql
apt-get install -y php7.0-mcrypt
apt-get install -y php7.0-curl
apt-get install -y php7.0-intl
apt-get install -y php7.0-xsl
apt-get install -y php7.0-mbstring
apt-get install -y php7.0-zip
apt-get install -y php7.0-bcmath
apt-get install -y php7.0-iconv
apt-get install -y php7.0-soap
apt-get install -y libapache2-mod-php7.0

Instalar PHP 5.6

apt-get -y update
add-apt-repository ppa:ondrej/php
apt-get -y update
apt-get install -y php5.6
apt-get install -y php5.6-mcrypt
apt-get install -y php5.6-mbstring
apt-get install -y php5.6-curl
apt-get install -y php5.6-cli
apt-get install -y php5.6-mysql
apt-get install -y php5.6-gd
apt-get install -y php5.6-intl
apt-get install -y php5.6-xsl
apt-get install -y php5.6-zip
apt-get install -y php5.6-soap
sudo apt-get install -y php-pear
sudo apt-get install -y pkg-php-tools