This really shouldn’t have been that hard, but it took quite a bit of searching and playing around to finally get this to work.
I started at PHP’s IMAP web page which informed me that the first thing I needed to do was grab the c-client libraries and compile it. You can find these here: ftp://ftp.cac.washington.edu/imap/.
cd /SourceCache
curl -O ftp://ftp.cac.washington.edu/imap/c-client.tar.Z
tar -xzvf c-client.tar.Z
cd imap-2007a
sudo make oxp
sudo mkdir /usr/local/imap-2007h/lib
sudo mkdir /usr/local/imap-2007h/include
cp imap-2007a/*.h /usr/local/imap-2007a/include
cp imap-2007a/*.c /usr/local/imap-2007a/lib
cp c-client.a /usr/local/imap-2007a/lib/libc-client.a
When Apple built Leopard they forgot to include the MySQL header files, but were kind enough to offer them up for download at http://www.opensource.apple.com/darwinsource/other/. Download the MySQL binaries, untar and follow the instructions in the README. Its very simple.
Now that we have IMAP ready to go, and the required MySQL header files in place, we need to make sure we have openssl and iconv libraries installed. (Or, if you don’t want to use openssl or iconv you can omit them from your configuration) I already had them installed through macports, but you can compile them manually if you’re feeling like you want to further torture yourself during this process. With macports its a simple sudo port install openssl and libiconv.
When Apple compiled PHP on Leopard they were kind enough to leave behind the PHP source they compiled from in /SourceCache. So now we can…
cd /SourceCache/php-5.2.4
sudo ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/var/mysql --with-mysqli=/usr/bin/mysql_config --with-mysql=/usr --with-iconv=shared,/opt/local --with-openssl=shared,/opt/local --with-xmlrpc --with-xsl=/usr --with-imap=/usr/local/imap-2007a --without-pear
sudo make
sudo make install
sudo apachectl restart
That should be it. If you got errors during any part of that, all I can say is, I’m sorry. It worked for me. I’m posting several links I used to figure all this out that might help you if you run into any snags.
http://discussions.apple.com/thread.jspa?threadID=969019&tstart=0 http://discussions.apple.com/message.jspa?messageID=6112771 http://diymacserver.com/forum/topic/86 http://blog.phpdoc.info/archives/83-php-5.2.5-on-Leopard.html#extended