You could run php4 as CGI and php5 as mod_php (or the other way round). http://www.howtoforge.com/apache2_with_php5_and_php4