$ sudo apt-get -y remove php-*
$ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get -y update $ sudo apt-get -y upgrade $ sudo apt-get -y install php7.1 libapache2-mod-php7.1
$ php -v PHP 7.1.6-1~ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 9 2017 08:26:34) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.6-1~ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
必要に応じて、追加モジュール。
$ sudo apt-get -y install php-mbstring $ sudo apt-get -y install php-mcrypt $ sudo apt-get -y install php-mysqlnd $ sudo apt-get -y install php-gd $ sudo apt-get -y install php-imagick $ sudo apt-get -y install php-apcu $ sudo apt-get -y install php-memcached $ sudo apt-get -y install php-xml $ sudo apt-get -y install php-fpm