get the tarballs for both, available at their respective sites, and unpack them both into the /usr/src/ dir and create symlinks like so:
ln -s apache-1.x.xx apache
ln -s php-4.1.xx php
in the apache src dir:
./configure --prefix=/your/apache/path
(my apache path is /usr/local/apache) but it can be whatever you want
then cd into your php src dir (/usr/src/php) and do this:
./configure --with-apache=/usr/src/apache \
--enable-track-vars \
--with-zlib
there are also some additional steps you'll want to take if you compile apache with mysql (which i highly recommend). now do the following:
make
make install
cd ../apache
./configure --prefix=/usr/local/apache \
--activate-module=src/modules/php4/libphp4.module
make
make install
now you should be ready to run apache with php. there are some various issues i ran into (like the php module not being in the httpd.conf file, which you may need to add). plus errors when i tried to build apache with php. this can get pretty in depth though, so i'll refer you to this site which should be able to walk you through the rest:
http://www.rocketry.org/~tim/tutorials/mysql.php
good luck! :-)