I installed php on ubuntu 14.04 with nginx but the version installed was php 5.5.9. Since I wanted to upgrade it to php 5.6 I fired the below commands:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
I got a message stating that the ppa is depricated but however php 5.6 was installed and working fine only that it was showing as PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
I later went on and entered the command LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
and sudo apt-get install php5.6
which again installed php5.6 for me.
Now when I do: php -v
I get PHP 5.6.23-1+deb.sury.org~trusty+2 (cli)
and when I do: php5 -v
I get PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
How do I remove the deprecated one?
To get rid of the deprecated message, you need to use different ppa: repository.
You have to remove existing packages and the deprecated repository. Then, add the new repository and install the packages you need:
# Remove old ppa: and its packages
sudo add-apt-repository ppa:ondrej/php5-5.6 --remove --yes
sudo apt-get --purge remove php5-common
# Add the new ppa:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
# If you are using it with Apache, run:
sudo apt-get install libapache2-mod-php5.6
# If you are using it with Nginx, run:
sudo apt-get install php5.6-fpm
Subsequently, you have to make changes to web server configuration, since some paths have changed in the PHP-FPM configuration, etc.
More info here.