Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have PHP 5.0 installed on my Debian VPS and was wondering how I would be able to upgrade it to PHP 5.3 and keep all of my installed modules running.

share|improve this question
By running, do you mean working? Or are you trying to upgrade php without taking the webserver down? – Falmarri Oct 21 '10 at 2:47
I just want to upgrade from PHP 5.0 to PHP 5.3 - the web-server can go down but I don't want to lose any data of course :) – Jake Oct 21 '10 at 2:51

If you haven't checked already, you should check if the package that you want is in backports before adding testing or unstable to your sources. If it isn't, you'll want to be very careful about pulling in packages from other releases, they might also want to upgrade many other things on the system.

share|improve this answer

You might have a look at dotdeb. They have Debian packages for Debian-based LAMP servers and offer among others packages for PHP 5.3.

share|improve this answer
Just a note: on Ubuntu I've had lots of problems with dotdeb, and would never run it in production. But that's just on Ubuntu, might work flawlessly on Debian – Znarkus Jan 14 '11 at 9:36

unstable repositories contain right now the 5.3.3-2 version of php.

Using a test environment, add unstable to your sources-list and just try:

apt-get update
apt-get install php5

In my previous experience, it works very well. If you're using non-standard modules, check for compatibility before trying to upgrade.

share|improve this answer

The staging area for the next Debian release, Squeeze, has been having PHP 5.3 since early 2010. So, add squeeze to your '/etc/apt/sources.list', then:

apt-get update
apt-get --simulate install php5

Check output, ensure important packages won't be deleted, and system libraries won't be upgraded (or keep it at a minimun), and if things look ok:

apt-get install php5

Of course this should be a temporary measure. That is, remove that squeeze line from 'source.list' when your are done installing that PHP.

share|improve this answer
Mixing binary packages from different debian branches is not recommended and considered to greatly increase the chances of either breaking or making a system behave unstable. – Arrowmaster Feb 24 '11 at 6:57
@arr Am aware, that's why I mentioned that user must run a simulator first to see the risks (what packages will be installed, upgrade, and remove) beforehand. – Tshepang Feb 24 '11 at 6:59
The risks are always there just because the binary was built against different shared library versions, it has nothing to do with other packages being installed or not when you do it. – Arrowmaster Feb 24 '11 at 7:01
@arr In that case (AFAIK), the newer package will depend on the packages providing the specific shared libraries it was built against. That's why it's recommended that one should rather use backports if available. – Tshepang Feb 24 '11 at 9:09
The proper way to install newer versions of a package is by using backports, not by mixing distros. – Shadur Oct 18 '13 at 9:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.