http://blog.xeonxai.com/2009/12/03/160/
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.
3 Comments
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
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
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