HowToForge.com has a new tutorail posted today that aims to show you how to run both PHP4 and PHP5 on a single Apache2 web server.
I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!
This tutorial shows how to install and configure Apache2 with PHP5 and PHP4 enabled at the same time. Because it is not possible to run both PHP5 and PHP4 as Apache modules, we must run one of them as CGI, the other one as Apache module. In this document I will use PHP5 as Apache module and PHP4 as CGI, and I will describe the setup for the Linux distributions Debian Sarge (3.1) and Ubuntu 5.10 (Breezy Badger).
They base the entire installation around Debian, so ideally you're set up on it or have some pretty good knowledge of linux in general. They apt-get install several packages, change some Apache config files, enable some modules, and restart things to get it all set up. The Ubuntu install is just about as easy, wiht only really a few items changed.