kevin,
what you can do is:
1) download the source of php3 (the version you have on the system), unless you have the source already
2) go to the toplevel of the source (e.g. /path/to/php3) and run "make uninstall". That should (hopefully) remove all the binaries and config the php3 installed on your system.
3) download/goto the source of php4. read the install file. If you are going to install apache from the source too, then go down to the part of the INSTALL file where it says (QUICK START -- STATIC INSTALLATION).
4) follow the steps there.
5) hopefully you'll have the php4 and apache1.3.12 installed successfully!