Skip to content

Instantly share code, notes, and snippets.

@nickrouty
Last active August 29, 2015 14:02
Show Gist options
  • Save nickrouty/52269b159bd283710830 to your computer and use it in GitHub Desktop.
Save nickrouty/52269b159bd283710830 to your computer and use it in GitHub Desktop.
Install PHP IMAP Extension for OSX Mavericks
#!/bin/bash
BUILDDIR=/tmp/php_imap_mavericks
mkdir "$BUILDDIR"
echo " "
echo "= FETCHING AND INSTALLING IMAP"
echo " "
cd "$BUILDDIR"
wget -c ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
rm -rf imap-2007f
tar xvvfz imap-2007f.tar.gz
cd imap-2007f
make osx EXTRACFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
sudo mkdir -p /usr/local/imap-2007f/include
sudo cp c-client/*.h /usr/local/imap-2007f/include
sudo mkdir -p /usr/local/imap-2007f/lib
sudo cp c-client/c-client.a /usr/local/imap-2007f/lib/libc-client.a
echo " "
echo "= FETCHING AND INSTALLING PCRE"
echo " "
cd "$BUILDDIR"
wget "http://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz"
rm -rf pcre-8.35
tar xvvfz pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local
make
sudo make install
echo " "
echo "= FETCHING AND INSTALLING PHP-IMAP"
echo " "
cd "$BUILDDIR"
PHPVERSION=`php --version|head -n1|cut -f 2 -d ' '`
##git clone -b "PHP-$PHPVERSION" https://github.com/php/php-src.git php-src
wget --no-check-certificate -c https://github.com/php/php-src/tarball/PHP-5.4.24 -O PHP-5.4.24.tar.gz
tar xvvfz PHP-5.4.24.tar.gz
cd `ls |grep php-php-src-|head -n1`
cd ext/imap
phpize
./configure --with-imap=/usr/local/imap-2007f --with-kerberos --with-imap-ssl
make
sudo cp modules/imap.so /usr/lib/php/extensions/no-debug-non-zts-20100525/
echo " "
echo " Don't forget to add `extension=imap.so` into your php.ini file and restart apache."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment