共计 2119 个字符,预计需要花费 6 分钟才能阅读完成。
一、CentOS 6.7 x64 上手动扩展 PHP 的 IMAP 模块
1、准备
yum install -y libc-client-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
ln -s /usr/lib64/libkrb5.so /usr/lib/libkrb5.so
ln -s /usr/lib64/libssl.so /usr/lib/libssl.so
2、安装
cd/usr/local/php-5.5.35/ext/imap/
/usr/local/php/bin/phpize
./configure -with-imap -with-php-config=/usr/local/php/bin/php-config –with-kerberos=/usr –with-imap-ssl=/usr
make
make install
3、添加模块
vim /usr/local/php/etc/php.ini // 添加
extension = “imap.so”
重启 PHP
/etc/init.d/php-fpm restart
再次查看 PHP 模块,可以发现已经有 imap 模块了
注意:./configure 编译报错
报错 1:configure: error:utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This shouldnot happen. Check config.log for additional information
解决:
yum install -y libc-client-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
报错 2:configure: error:Kerberos libraries not found. Check thepath given to –with-kerberos (if no path is given, searches in /usr/kerberos,/usr/local and /usr)
解决:ln -s /usr/lib64/libkrb5.so /usr/lib/libkrb5.so
报错 3:configure: error:Cannot find OpenSSL’s libraries
解决:ln -s /usr/lib64/libssl.so /usr/lib/libssl.so
重新./configure 编译即可。
二、CentOS 7.0.1406 x64 上手动扩展 PHP 的 IMAP 模块
1、安装 php-imap
yum install -y pam-devel
cd /usr/local/src/
wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
tar -zxvf imap-2007f.tar.gz
cd imap-2007f
make lr5 PASSWDTYPE=std SSLTYPE=unix.nopwd EXTRACFLAGS=-fPIC IP=4
mkdir /usr/local/imap-2007f/
mkdir /usr/local/imap-2007f/include/
mkdir /usr/local/imap-2007f/lib/
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
2、php 手动加载 php-imap
cd /usr/local/php-7.1.0/ext/imap/
/usr/local/php/bin/phpize
./configure -with-imap=/usr/local/imap-2007f -with-php-config=/usr/local/php/bin/php-config –with-imap-ssl=/usr
make
make install
注意:./configure 编译报错
报错:configure: error:Cannot find OpenSSL’s libraries
解决:确认已安装过 openssl、libssl-dev 包,但是还是会提示该错误
find / -name libssl.so // 查找到路径为:/usr/lib64/libssl.so
ln -s /usr/lib64/libssl.so /usr/lib
重新编译即可
3、添加 php-imap 模块
vim /usr/local/php/etc/php.ini // 添加
extension =”imap.so”
重启 PHP
/etc/init.d/php-fpm restart
再次查看 PHP 模块,可以发现已经有 imap 模块了
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/142963.htm