Ubuntu 14.04: Upgrade to php7 and uninstall php5?

unadivadantan picture unadivadantan · Nov 15, 2016 · Viewed 8.4k times · Source

I'm upgrading the php version to 7.0 in my docker image which is based on Ubuntu 14.04. I read some articles giving the commands to uninstall php5 while installing php7.0. Is this really necessary? What are the pros and cons?

Answer

md123 picture md123 · Jan 18, 2017

add the new repository for PHP 7:

 apt-get install software-properties-common
 add-apt-repository ppa:ondrej/php

remove PHP 5 from your system and install PHP 7

 apt-get update && apt-get purge php5-fpm && apt-get --purge autoremove && apt-get install php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-opcache php7.0-xml

see this article for more details

https://bjornjohansen.no/upgrade-to-php7