Programster's Blog

Tutorials focusing on Linux, programming, and open source

Debian 7.x - Install PHP 5.6

Debian 7.8 will install PHP 5.3.3 by default. If you want to get version 5.6 which has performance improvements, or if you need the "readline" function to work, then you can use the Dotdeb packages to install version 5.6. Dotdeb is a repository containing packages to turn your Debian boxes into powerful, stable and up-to-date LAMP servers.

Steps

Add the Dotdeb main repositories

echo "deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all" | sudo tee -a $FILEPATH

Add the Dotdeb repos necessary for php 5.6 (threadsafe)

echo "deb http://packages.dotdeb.org wheezy-php56-zts all
deb-src http://packages.dotdeb.org wheezy-php56-zts all" | sudo tee -a $FILEPATH

Add the GPG key

wget http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg

Now update and install the packages you need.

sudo apt-get update
sudo apt-get install php5-cli -y