MAMP Pro: Using imap with SSL

Hi There! This is my first post on my blog. I’m gonna blog about my daily work (problems i ran into and how to solve them) and my hobbies.

Today i was playing with reading mailboxes with PHP. When i tried to read my gmail box i noticed that my MAMP Pro installation had no imap SSL support.

After long searching i found a blogpost that helped me out. To make it more easy i linked all the necessary files in my post.

To fix this issue you will need to compile a new imap.so file with SSL support enabled. In this post i will explain how easily this can be done.

  • You will need the php source (check the version you’re using in MAMP)
  • Autoconf
  • imap lib files

Extract the contents of the php source to /Applications/MAMP/bin/php/php5.4.4/include/php/

If you don’t have autoconf on your machine then you use the one supplied on the MAMP Server components and libraries. Start by unzipping the autoconf-2.68.tar.gz file and go to terminal on that folder and run:

./configure
make
make install

Now that we have all the files and binaries needed, let’s build the imap-2007e lib files needed to compile the new imap.so module.

Start by unzipping the imap-2007e.tar.Z from the MAMP Server components and libraries and go to the terminal on that folder and run:

make osx EXTRACFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" 

This will create the c-client/*.h, c-client/*.c, c-client/c-client.a files needed in your local library. Let’s copy them:

sudo mkdir -p /usr/local/include
sudo cp c-client/*.h /usr/local/include/
sudo mkdir /usr/local/lib
sudo cp c-client/*.c /usr/local/lib/
sudo cp c-client/c-client.a /usr/local/lib/libc-client.a

Building our imap.so

Now we are ready to start compiling the php module. Go to the /Applications/MAMP/bin/php/php5.4.4/include/php/ folder created previously on the terminal and run:

./configure
cd ext/imap
phpize
./configure --with-imap=/usr/local/imap-2007 --with-kerberos --with-imap-ssl=/usr/
make

Now, if everything went as expected, you can copy the new imap.so to the MAMP library:

cp modules/imap.so /Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/

After restarting your Apache on MAMP, confirm that you can see the SSL Support set as enabled in imap group on your phpinfo.

Schermafbeelding 2015-01-18 om 17.41.36

Credits: http://blog.open-war.com/mamp-imap-ssl

 

If you have any problems, you can look over here:

http://www.allsupported.com/category/mamp-pro/