Using phpinfo(), I have found that the installed version of PHP is 7.0.26. I want to upgrade it to PHP 7.2.
1 Answer
You have to install the PHP 7.2 (or any higher version 7.x) and remove your old version if you don't need it any more.
First add the PPA ppa:ondrej/php, run:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Second install the version you need 7.2 in your case, run:
sudo apt install php7.2
Third if you want to remove your old existing version, run
sudo apt remove php7.0
-
Probably the php module for apache2 should be installed and enabled:
sudo apt install libapache2-mod-php7.x && a2enmod php7.x
, wherex
refers to the certain version..– pa4080Dec 28, 2017 at 11:05