How to update php 7.0 to php 7.2 ubuntu 16 vestacp using php-fpm or apache

In this video tutorial, I showed you how you can update you PHP 7.0 which is deprecated now to PHP 7.2 in ubuntu 16.04 LTS using vestacp including PHP 7.2 all required libraries and how to change vestacp configuration to load new PHP 7.2, how to move your existing domains to PHP 7.2, how to switch php-fpm 7.0 to 7.2 or vice versa

A lot of issues arose even after that like adding new domains or adding SSL cert and found web template missing and I fixed all those issues as well and will make some video on it might be not detailed will provide all instructions so it will help.

Commands to use:
php -v
[to check existing version of php]

v-backup-user admin
[This will backup all users at once]

dpkg –get-selections | grep -v deinstall | grep php7.0
[to see all the installed apckages for php 7.0] Mcrypt is not required to install for PHP 7.2 and latest versions -copy all those

apt-get update
apt-get install python-software-properties
apt install software-properties-common

[Add source]
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.2

apt-get install php7.2-cgi php7.2-curl php7.2-fpm [or whatever packages you copied from –get selections command by replacing php7.0 with 7.2]

a2dismod php7.0
a2enmod php7.2

sudo nano /etc/php/7.2/fpm/php.ini

/etc/init.d/php7.2-fpm stop
/etc/init.d/php7.0-fpm stop
update-alternatives –config php
[Make sure alternative is set for php 7.2]

/etc/init.d/php7.2-fpm restart
service nginx restart

[the web interface will still be running on PHP 7.0]
[Now check the installed php versions]

cd /etc/php/
cd 7.2/fpm/

[Now check the vesta configuration]

vi /usr/local/vesta/conf/vesta.conf

[Change the WEB_BACKEND to]

[Now go to fpm dir of PHP 7.0 to copy all files need to paste in 7.2 for existing sites]

cd /etc/php/7.0/fpm/pool.d

[copy all files inside the same dir of 7.2]

cp * ../../../7.2/fpm/pool.d/

/etc/init.d/php7.0-fpm stop
/etc/init.d/php7.2-fpm start

You may also like...