Add source using PPA:
$ sudo apt-get install python-software-properties$ sudo add-apt-repository ppa:ondrej/php$ sudo apt-get update$ sudo apt-g ET install-y php7.0 php7.0-mysql php7.0-curl Php7.0-json php7.0-cgi
You can then view the PHP version:
Php-v
About the php5.4--php5.6 version
$ sudo apt-get install python-software-properties$ sudo add-apt-repository ppa:ondrej/php$ sudo apt-get update$ sudo apt-g Et-y Install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl ph P5.6-zip
See the PHP7 Extension
Or you can install the source code
1. Download the PHP7 source package
2.TAR-ZXVF Decompression
sudo apt-get install Php5-mcrypt Libmcrypt-dev
sudo apt-get install Libxslt-dev Libxml2-dev
4./configure--PREFIX=/ZHOU.DATA/PHP/PHP7--enable-maintainer-zts-with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd-- With-mhash--with-openssl--with-zlib--with-bz2--with-curl--with-zlib--enable-mbstring--with-mcrypt-- Enable-sockets--with-xsl--enable-zip--with-pear--enable-session--enable-xml--enable-shared--enable-bcmath-- Enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-mbregex--enable-pcntl--with-xmlrpc
5.make && make Install
6. If you get an error, what dependencies are missing, just one installation
Ubuntu installs PHP5.6--PHP7 using Apt-get install