1) sudo ./buildconf --force
2)sudo ./configure --prefix=/etc/php72 --enable-bcmath --with-pcre-dir=/soft/php72/php-7.2.1/ext/pcre --with-gettext=/usr/lib/gettext --with-pgsql=/usr/lib/postgresql/9.5 --with-pear=/soft/php72/php-7.2.1/pear --with-tsrm-pthreads --enable-maintainer-zts --with-openssl --enable-pthreads=shared --enable-cli --enable-mbstring --enable-intl --enable-zip --enable-mysqlnd --enable-sockets --with-gd --with-mysqli --with-pdo-mysql --with-openssl --enable-dba=shared --enable-opcache --enable-calendar --enable-exif --enable-pcntl
3) sudo make sudo make test sudo make install
//////////////////////////////////// sudo -i
apt-get update
apt-get install -y git bison autoconf build-essential pkg-config gitcore libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev
mkdir /etc/php7
mkdir /etc/php7/cli
cd /usr/local/src
git clone https://github.com/php/php-src.git --depth=1
cd php-src/ext
git clone https://github.com/krakjoe/pthreads -b master pthreads
cd ..
./buildconf --force
php_configure_args="--prefix=/etc/php7 --with-config-file-path=/etc/php7/cli --with-config-file-scan-dir=/etc/php7/cli/conf.d --with-bz2 --with-zlib --enable-zip --with-openssl --with-curl --enable-ftp --with-mysqli --enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext --with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl --enable-bcmath --enable-mbstring --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-maintainer-zts --enable-debug --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-cli --enable-pthreads=shared --with-tsrm-pthreads"
./configure $php_configure_args
make && make install
cd /usr/local/src/php-src/ext/intl*
chmod a+x /etc/php7/bin/php-config
chmod a+x /etc/php7/bin/phpize
/etc/php7/bin/phpize
./configure --enable-intl --with-icu-dir=/usr --prefix='/etc/php7' --with-libdir='/lib/x86_64-linux-gnu' --with-php-config='/etc/php7/bin/php-config'
make && make install
cp /usr/local/src/php-src/php.ini-production /etc/php7/cli/php.ini
ln --symbolic /etc/php7/bin/php /usr/bin/php
ln --symbolic /etc/php7/sbin/php-fpm /usr/sbin/php7-fpm
echo 'zend_extension=opcache.so' >> /etc/php7/cli/php.ini
echo 'extension=pthreads.so' >> /etc/php7/cli/php-cli.ini
echo "extension=intl.so" >> /etc/php7/cli/php.ini