Seeing as how the stock Apple Mac OS X 10.6 Snow Leopard PHP 5.3 doesn’t come with IMAP extension support, I realized it was time to add it in to build a tool to extract data from my gmail account emails. Here is the steps I took to get it installed and working.
Download IMAP source code. (2007e as of writing this). Without this, trying to compile the IMAP PHP extension will give you errors and will refuse to compile.
Unpack the imap-2007e.tar.gz file.
sudo mv ~/Downloads/imap-2007e /usr/local/imap-2007 cd /usr/local/imap-2007 make osx sudo cp c-client/c-client.a c-client/libc-client.a
Unpack the file php-5.3.0.tar.gz. We will only need to use the code within the ext/imap directory. No need to compile all of PHP for this.
cd ~/Downloads/php-5.3.0/ext/imap phpize ./configure --with-imap==/usr/local/imap-2007 --with-kerberos --with-imap-ssl make sudo cp modules/imap.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
Add in the extension location to the php.ini file.
sudo pico /etc/php.ini
I placed the following after all the commented out lines for extensions:
After you have placed that line in there, press Control-X to exit and save.
sudo apachectl graceful
Now you should be able to see the imap extension installed in your stock Apple PHP.