It's not recommended to install a version of php that isn't provided by the default ppa's, but if you want to do it this is what you should do:
First we add a repo that contains the file we need, but as Ubuntu Server can't add repos at the default setting write the following command to be able to add repos:
sudo apt-get install python-software-properties
After that we can add the repo by typing:
sudo add-apt-repository ppa:ondrej/php5
Then we can upgrade php by typing these two commands:
sudo apt-get update
sudo apt-get upgrade
To be sure if you have the right version type:
php -v