12.04 install php 5.4

# 安裝 add-apt-repository

apt-get install python-software-properties

# PHP 5.4 & Apache 2.2

add-apt-repository ppa:ondrej/php5-oldstable
apt-get update
# 一定要 upgrade
apt-get upgrade

The following packages have been kept back:
  php-apc php5 php5-cgi php5-cli php5-common php5-curl php5-gd php5-imap php5-mcrypt php5-mysql
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

apt-cache show php

Package: php5
Priority: optional
Section: php
Installed-Size: 21
Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: all
Version: 5.4.35-1+deb.sury.org~precise+1
Depends: libapache2-mod-php5 (>= 5.4.35-1+deb.sury.org~precise+1)

......................

Package: php5
Priority: optional
Section: php
Installed-Size: 21
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: all
Version: 5.3.10-1ubuntu3.15
Depends: libapache2-mod-php5 (>= 5.3.10-1ubuntu3.15)

......................

Package: php5
Priority: optional
Section: php
Installed-Size: 21
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Architecture: all
Version: 5.3.10-1ubuntu3
Depends: libapache2-mod-php5 (>= 5.3.10-1ubuntu3)

apt-get install php5

# PHP 5.5 & Apache 2.4

sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5

Creative Commons license icon Creative Commons license icon