Snow Leopard PHP and IMAP Support

By Xeon Xai  

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.

Step 1:

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.

In Terminal:

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

Step 2:

Download PHP 5.3.0 source code for the php imap extension here. I already had a copy from my previous extension tutorial, so I just used that copy.

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.

In Terminal:

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/

Step 3:

Add in the extension location to the php.ini file.

In Terminal:

sudo pico /etc/php.ini

I placed the following after all the commented out lines for extensions:

extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/imap.so

After you have placed that line in there, press Control-X to exit and save.

Step 4:

Restart Apache.

In Terminal:

sudo apachectl graceful

Now you should be able to see the imap extension installed in your stock Apple PHP.

VN:F [1.8.1_1037]
Rating: 10.0/10 (1 vote cast)
VN:F [1.8.1_1037]
Rating: 0 (from 0 votes)
Snow Leopard PHP and IMAP Support10.0101

3 Comments

  1. Lorenzo
    Posted December 30, 2009 at 3:24 AM | Permalink | Reply

    Followed your instructions thoroughly
    ./configure… fails in step2 with
    configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

    I checked that I had the openssl library installed…

    Do you have any further possible ideas ?
    Thanks
    Lorenzo

    UN:F [1.8.1_1037]
    Rating: 5.0/5 (1 vote cast)
    UN:F [1.8.1_1037]
    Rating: +1 (from 1 vote)
  2. Chris Peltenburg
    Posted January 8, 2010 at 4:56 PM | Permalink | Reply

    Hi Lorenzo,

    found a solution for your ( and mine too ) problem! Thanks to Alexey Kulikov

    cd imap-2007e/
    make osx EXTRACFLAGS=”-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp”
    sudo mkdir /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

    Then follow the instructions from Step 2

    UN:F [1.8.1_1037]
    Rating: 5.0/5 (1 vote cast)
    UN:F [1.8.1_1037]
    Rating: +1 (from 1 vote)
  3. tedivm
    Posted January 29, 2010 at 1:58 AM | Permalink | Reply

    In step three you should add the path to the “with-imap-ssl” flag-

    ./configure –with-imap=/usr/local/imap-2007 –with-kerberos –with-imap-ssl=/usr/local/ssl

    UN:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.1_1037]
    Rating: 0 (from 0 votes)

Post a Comment

Your email is never shared. Required fields are marked *

*
*