怎样安装PHP的imap扩展

2018年9月29日 | 分类: 【技术】

【安装】

进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择imap模块。

wget http://php.net/distributions/php-7.3.0.tar.xz && tar -xvf php-7.3.0.tar.xz && cd php-7.3.0
cd ext/imap
/usr/local/php/bin/phpize
./configure --with-imap --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap-ssl
make
make install

输出:

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20180731/

【设置】

在 php.ini 文件中添加:

; [imap]
extension = "imap.so"

然后重启Apache即可加载。

【排错】

如果 configure 报错:

checking for U8T_DECOMPOSE... no
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missi                                                                                                                                                             ng. This should not happen. Check config.log for additional information.

参考:http://amon.org/php-compile-errors

yum install libc-client-devel

如果没有这个包,可以手动安装:

下载:https://centos.pkgs.org/6/centos-x86_64/libc-client-2007e-11.el6.x86_64.rpm.html
下载:https://centos.pkgs.org/6/centos-x86_64/libc-client-devel-2007e-11.el6.x86_64.rpm.html

rpm -ivh http://mirror.centos.org/centos/6/os/x86_64/Packages/libc-client-2007e-11.el6.x86_64.rpm
rpm -ivh http://mirror.centos.org/centos/6/os/x86_64/Packages/libc-client-devel-2007e-11.el6.x86_64.rpm

如果安装版本错误,可以搜索/删除:

rpm -q libc-client-2007f-16.el7.x86_64
rpm -e --nodeps libc-client-2007f-16.el7.x86_64

如果 configure 报错:

Cannot find imap library (libc-client.a)

软连接:

ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so 

【参考】

参考:https://bbs.csdn.net/topics/340269102
参考:https://timhbw.com/86.html
参考:https://www.awaimai.com/2120.html