Raspberry pi runs Debian Wheezy, but with just one quick line change we can upgrade to Debian Jessie which is a newer version and provides PHP 5.5 binaries (5.5.8 at the time of this blog post.)
Start out by editing the APT sources:
vim /etc/apt/sources.list
Change wheezy to jessie, so that it looks like this:
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
(Don’t add or remove any lines, just change the one above)
Now run:
apt-get update && apt-get upgrade && apt-get autoremove
If you havent aready installed PHP, you can do it now via:
apt-get install php5 php5-cli
Finally, confirm your PHP version:
php -v
This should result in:
PHP 5.5.8-2 (cli) (built: Jan 18 2014 07:39:52)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies