Best way to have both php 5.2 and php 5.3 at the same time in Ubuntu

Matt asked:

I am using Ubuntu 12.04. I need (this is not an option) to have both php 5.2 and php 5.3 installed. I think I need to compile 5.2 from source and keep it in /usr/local or make checkinstall.

Is there any better way? How would you do this? Are there any official repositories with php52 for Ubuntu?

Note: I need php-fpm with my 5.2 too, so binary versions without fpm patch won’t help me.

My answer:

Use separate virtual machines: Place the ancient legacy software in a VM running PHP 5.2, probably on Ubuntu 10.04, while you run the modern software on PHP 5.3 on Ubuntu 12.04.

And then, of course, get rid of the ancient legacy software as quickly as you can…

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.