Do not update php CLI version in ubuntu 17.04

0

I am trying to update my php version, from 7.1.9 to 7.2.7

I use:

sudo apt-get update
sudo apt-get upgrade
sudo add-apt-repository ppa: ondrej / php
sudo apt-get install php7.2 php7.2-common
sudo apt-get install php7.2 php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-mysql php7.2-mbstring
sudo apt-get update
sudo apt-get upgrade

then I run php -v

and he shoots me:

PHP 7.1.9 (cli) (built: Sep 18 2017 02:29:39) (NTS)

I can not get the version that I just downloaded.

I try with:
sudo update-alternatives --set php /usr/bin/php7.2

and neither, again:

PHP 7.1.9 (cli) (built: Sep 18 2017 02:29:39) (NTS)

I try with:
sudo a2enmod php7.2 (before I verify that apache is stopped)

who returns to me:

Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Module php7.2 already enabled

and until here it arrives, because it continues with:

PHP 7.1.9 (cli) (built: Sep 18 2017 02:29:39) (NTS)

I will greatly appreciate help, I do not know what command to execute.

    
asked by rendor9 15.07.2018 в 05:11
source

1 answer

0

hello before installing any php version or other language you should first see if you already have it installed, maybe it will not allow you to install the system again, etc for that run this command from the ubuntu terminal:

php -v

then you look at the modules installed in ubuntu with the following command:

$ dpkg — get-selections | grep -v deinstall | grep php7.0

then simply install it with the following command:

sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm

but first of all do not forget to add the:

  
  • Add PPA ondrej / php
  •   

    with the following command:

    sudo add-apt-repository ppa:ondrej/php
    sudo apt update
    

    more info here

        
    answered by 15.07.2018 в 05:38