I need to add some composer packages to my site that require PHP 5.6, so how can I upgrade from PHP 5.5.9 to PHP 5.6 on Ubuntu 16.04 with Nginx 1.4.6 as a server?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @mbasfour,

There is no out of the box way to upgrade PHP versions. What you need to do is just install the higher version.

In your case, you can do the following to enable PPA for PHP 5.6 in your Ubuntu system and install PHP 5.6.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6

Since you are using Nginx, you might need to install

sudo apt-get install php5.6-fpm php5.6-mysql 

As well.