HOWTO: PHP with IMAP support for CentOS6

I’ve pulled my hairs getting a proper working version of IMAP compiled within PHP. The trick was to compile the extension without issues. I wanted to get the latest version of IMAP.

As such the way to go on CentOS 6.3 x86_64 (64 bits) was:

Prepare the OS


yum install -y pam-devel libc-client libc-client-devel

Install IMAP from source


tar -zxvf imap-2007f.tar.gz
cd imap-2007*
make lr5 PASSWDTYPE=std SSLTYPE=unix.nopwd IP6=4
echo "set disable-plaintext nil" > /etc/
mkdir /usr/local/imap-2007f
mkdir /usr/local/imap-2007f/include/
mkdir /usr/local/imap-2007f/lib/
chmod -R 077 /usr/local/imap-2007f
rm -rf /usr/local/imap-2007f/include/*
rm -rf /usr/local/imap-2007f/lib/*
cp imapd/imapd /usr/sbin/
cp c-client/*.h /usr/local/imap-2007f/include/
cp c-client/*.c /usr/local/imap-2007f/lib/
cp c-client/c-client.a /usr/local/imap-2007f/lib/libc-client.a

and then add to your php.ini


--with-imap-ssl=/usr/local/imap-2007f \
--with-imap=/usr/local/imap-2007f \

Hope this will help