源码添加PHP-imap拓展

近日在添加PHP-imap扩展时需要到一些问题:直接编译存在找不到源码安装的OpenSSL库的情况,而使用Yum安装的会依赖其它包,尤其是系统自带的openssl-devel库。

经查找实践现已解决,用源码编译安装:

wget ftp://ftp.cac.washington.edu/mail/imap.tar.Z
tar zxf imap.tar.z -C /usr/local/src/
cd /usr/local/src/imap-2007f
make slx SSLINCLUDE=/usr/local/openssl/include/ SSLLIB=/usr/local/openssl/lib/ EXTRACFLAGS=-fPIC
mkdir /usr/local/imap-2007f/
mkdir /usr/local/imap-2007f/include/
mkdir /usr/local/imap-2007f/lib/
mkdir /usr/local/imap-2007f/c-client/
cp c-client/*.h /usr/local/imap-2007f/include/
cp c-client/*.c /usr/local/imap-2007f/lib/
cp c-client/*.c /usr/local/imap-2007f/c-client/
cp c-client/c-client.a /usr/local/imap-2007f/lib/libc-client.a
cp c-client/c-client.a /usr/local/imap-2007f/c-client/libc-client.a
cd /usr/local/src/php-7.1.4/ext/imap/
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config --with-imap=/usr/local/imap-2007f --with-imap-ssl=/usr/local/openssl/
make -j `cat /proc/cpuinfo | grep processor | wc -l` && make install
echo 'extension=/usr/local/php7/lib/php/extensions/no-debug-zts-20151012/imap.so' >> /usr/local/php7/php.ini 
httpd -k graceful

Apache重载之后,便可看到IMAP扩展已添加上:

发表评论

error: Content is protected !!