Additional interesting options one may add to the ./configuration script include --with-java=DIR, --with-ldap=DIR, -enable-ftp, --enable-trans-sid, and so on. Obviously each installation of PHP caters to the different needs for different servers. One may view the additional options by ./configure --help.
A warning about databases and PHP, with mod_perl. I recently came across what seemed like a normal installation of Apache, PHP and mod_perl, however, the Apache server kept terminating itself without warning. Upon investigation, I found that PHP was using PHP's default MySQL libraries, and not the official MySQL libraries that were present on the server. This caused a big conflict between PHP and mod_perl. If you are going to build PHP with MySQL, you have to configure it properly by adding this option to the configuration script: --with-mysql=/usr/local/. In this case, the directory /usr/local/ contains the external MySQL libraries, and therefore PHP used those and not the internal libraries.
The --with-apache tag shows PHP where the Apache source code is (from above). You may even use the full path name here (ie. /usr/local/src/apache/apache_1.3.x). If PHP complains that PostgreSQL could not be found, you will have to point out to configure where the header files are for PostgreSQL. The same rules apply if you are using Oracle or MySQL instead of PostgreSQL (read the README file for the specifics for the different database systems).
You will see a bunch of configuration values whiz by informing you what PHP has found on your system. The section, Configuration Tips, will explain how one can save these messages to a text file.