The approach we will use is to setup PHP4 as a (SAPI) Apache module on the default server address and setup PHP5 as a CGI module on a virtual host.
Part 1 Installing PHP4 as a SAPI module in Apache. This sections details how to configure and compile PHP4 as a SAPI module and then do the necessary Apache configuration modifications to enable this new module. By the end of this section we will have the ability to run PHP4 scripts on our server.
By assigning an alias IP-address on the server we can configure Apache with a virtual server based on this address. This new virtual server will have its own "cgi-bin/" as well as "htdocs/" directories. This part shows how to enable this by adding suitable configurations in Apache. By the end of this section our server will accept HTTP calls on a secondary IP-Address and use the specified document root for this new IP-address.
This final part shows how to configure and compile PHP5 as a CGI module that we then make available for the newly created virtual host in part 2. By the end of this module we will have PHP4 running on the default server address and PHP5 running on the secondary virtual host.