Pretty straightforward. First, make sure you have the Apache DEVELOPMENT rpm installed -- it contains a couple of tools you'll need to do the installation. Then download the latest PHP4 tarball from php.net. Unroll it. Change to the directory it created.
The INSTALL file covers the rest, but it pretty much boils down to this:
./configure --withmysql --withapxs
make
make install (as root)
You might need to edit httpd.conf to remove references to the php3 module.
apachectl restart