Upgrading to PHP 5.3 on Debian/Ubuntu
PHP 5.3 final release has been out for almost a year now. You can read up about all the new features and changes here. Important considerations in upgrading from PHP 5.2 are listed here, including a list of backwards incompatibilities (nothing too worrying).
Even though PHP 5.3 has been out for a while now, it's still a little hard to find in Debian repositories as it hasn't bubbled up to the main stable streams yet. This means if you use apt-get or aptitude or any related package managers, you'll only be able to get 5.2.x using the standard config.
To get access to 5.3 follow these steps:
- Backup your php.ini configuration file.
- Edit /etc/apt/sources.list and add the following line: "deb http://ftp.debian.org/debian/ squeeze main"
- >>apt-get update
- >>apt-get install php5
- locate the new php.ini file and transfer your settings from the old file if required
- Restart apache (/etc/init.d/apache2 restart)
I upgraded a significantly large project using this method and had to make no changes to any source-code. Everything appears to be working as expected, only a little snappier.
A note about the Debian repositories - Squeeze is the next upcoming major Debian release, in which PHP 5.3.2 is part of the testing stream. I found this out by using the package search tool at http://www.debian.org/distrib/packages. With this you can do a search for 'php5' and it will return a list of repositories with the corresponding package versions. You can then browse through the http://ftp.debian.org/debian/dists/ site to locate your package (open Packages.gz in a text-editor to confirm it contains the correct version of php or whatever package you may be looking for). You then simply transform this url into a relevant apt-get source.list item (http://ftp.debian.org/debian/dists/squeeze/main/binary-i386/ becomes "deb http://ftp.debian.org/debian/ squeeze main").
Some web-hosts/IT-departments will maintain their own package repositories and you won't be able to add external URLs. In this case, have a browse through their repository and see if you can find Debian Squeeze or Ubuntu Lucid, and troll through the main Packagez.gz file until you find the PHP version you're after (Ubuntu Lucid has 5.3.2-1).