You get a bonus - 1 coin for daily activity. Now you have 1 coin

Latest PHP 5.3 on Debian Squeeze

Practice



In Debian Squeeze (Debian 6), PHP version 5.3 is installed by default. That would be fine, but this marvel gets updated extremely rarely and slowly, and we, for example, want to always have the latest version of PHP. Or we've set up a server and just need to install PHP 5.3, specifically the latest version, not whatever Squeeze offers.


The dotdeb.org site will help us here. On this site, good people periodically build installation packages for Debian and post them to their repository for free download and installation. This way, we:
a) Don't bother compiling PHP by hand
b) Have the latest version of PHP 5.3 at the time of installation
c) Have automatic updates of PHP 5.3 via aptitude safe-upgrade


Well, let's get started.


1) Go to the /etc/apt directory and edit the sources.list file. We need to add the following lines to it:

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all


2) Now we need to add the key for installation.

$ sudo gpg --keyserver keys.gnupg.net --recv-key 89DF5277
$ sudo gpg -a --export 89DF5277 | sudo apt-key add -

If it didn't work (happens for various reasons... for example, the server is busy), you can import the key by hand:

$ cd ~
$ wget http://www.dotdeb.org/dotdeb.gpg
$ sudo apt-key add - < dotdeb.gpg


3) Update apt

$ sudo apt-get update


4) And finally, install PHP

$ sudo aptitude install php5

This command will install the latest available version of PHP 5.3 right away (5.3.6 at the time of writing this article, or newer — whatever is current at the moment).

I also recommend running the command:

$ aptitude search php5


which will show you which additional modules can be installed for PHP5.


Thanks to the dotdeb.org site for taking care of Debian administrators.

Applies to: Debian Squeeze + PHP 5.3 only

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)