In Debian Lenny, PHP 5.2 has version 5.2.6. But PHP versions are constantly updated, with bugs and security issues fixed. How can we install the latest version of PHP 5.2 on Debian Lenny?
Footnote: PHP 5.2 is no longer supported, the last version being 5.2.17. However, this doesn't mean nobody will ever need to install this version on a server, since there's a certain set of sites that simply don't work under 5.3.
So, we have Lenny (this doesn't work with Squeeze) and want to install PHP 5.2 on it. Let's begin.
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 oldstable all
deb-src http://packages.dotdeb.org oldstable 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.2 right away (5.2.17 at the time of writing this article, and most likely forever from now on, since support for 5.2 has been dropped).
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 Lenny + PHP 5.2 only
Comments