I used all of method to install the php

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

still got this error –

Reading package lists…
Done Building dependency tree

Reading state information…
Done E: Unable to locate package php5.6
E: Couldn’t find any package by regex ‘php5.6’

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.

1 answer

Hi @sauraj,

Ubuntu 10.04 has reached it’s end of life about 5 years ago - 01.04.2015. It’s pretty old OS and as such it’s bound to cause issues such as not being able to install newer PHP versions. I’ll highly recommend creating a Droplet with Ubuntu 18.04 and migrating your data there!

Anyway, let’s give it a try and install PHP5.6. FIrst, you’ll need to add the proper repository

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

I can see you’ve tried to add it, however can you try and execute the above 3 commands in the given order again?

Once doe, try again to execute

sudo apt install php5.6


Submit an Answer