Note that is not not necessary to disable SSL in the IMAP compile to make it work with PHP 5.0.3.
1. Compile IMAP with SSL support for your system:
make <system type> (ldb, lnx, etc)
2. Make links in IMAP source directory:
cp *.h ../include/
cp *.c ../lib/
cp c-client.a ../lib/libc-client.a
3. Compile PHP with SSL support, --with-imap=/path/to/imap/source/ . If SSL support fails, you'll get a configure-time error that IMAP doesn't work. This is a lie, you just need to get SSL support working in PHP. On certain linux systems, with OpenSSL 0.9.7, this means adding --with-openssl=/usr (if the OpenSSL files are in /usr/include/openssl/) instead of the proper directory containing the OpenSSL files. For some reason, giving a parent directory makes PHP able to find the OpenSSL include files.
4. PHP should build.
Alternately, you can disable SSL during the IMAP build, as per the previous directions posted here.