Ubuntu: Upgrade PHP 5 to PHP 7 the Fast Way
Purge old PHP packages and install a newer PHP from the ondrej/php PPA on Ubuntu — the quick upgrade path for legacy servers.
Ubuntu : upgrade php 5.* to php 7 latest and fastest
Step 1: remove everything related to php
sudo apt-get -y purge php.*
Step 2: install PHP 7
sudo apt-get -y update sudo add-apt-repository ppa:ondrej/php sudo apt-get -y update sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv
Further reading: PHP supported versions. Need a hand? Our PHP development team can help.
