PHP: Install and downgrade Apr 5, 2019 sudo apt-get install mysql-server sudo apt-get install php7.0 sudo apt-get install php7.0-cli sudo apt-get install libapache2-mod-php7.0 sudo apt-get install php7.0-mysql sudo apt-get install php7.0-xml //install 7.0 sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0 //which PHP CLI version should be used sudo update-alternatives --set php /usr/bin/php7.0 //disable one version and enable antoher sudo a2dismod php7.2 sudo a2enmod php7.0 sudo service apache2 restart //remove completely PHP from your system sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`