Install / upgrade PHP using APT and .deb packages on Ubuntu 12

ServerGrove provides a APT repository with the latest PHP versions packages in Deb format. This makes dead simple to install and upgrade PHP in Ubuntu 12 systems. Follow these steps to setup the repository in your server and install/upgrade PHP:

Setup ServerGrove repository

1) Add the repository to your server by adding this to /etc/apt/sources.list.d/servergrove.list: deb precise main

You may need to add the public key so packages can be verified, follow these steps: curl -O
| apt-key add servergrove-ubuntu-precise.gpg.key

2) Update packages list: $ apt-get update

Installing PHP

3) Install PHP: apt-get install php54 php54-apc

4) Install PHP Apache module: $ apt-get install php54-mod-php

Upgrading PHP

To upgrade PHP, run: $ apt-get upgrade

Configuration files and paths

The main installation is placed in /usr/local/php54 or /usr/local/php53. The configuration files are placed in /etc/php54 or /etc/php53.

PHP 5.3

For PHP 5.3, replace ‘php54’ with ‘php53’ in the package names.