【介绍】
参考:https://www.php.net/manual/zh/ref.imap.php
【安装】
下载 php 源码包并解压:
wget http://php.net/distributions/php-7.3.22.tar.xz && tar -xvf php-7.3.22.tar.xz && cd php-7.3.22
进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择imap模块。
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即可加载。
【排错(Ubuntu)】
如果 configure 报错:checking for U8T_DECOMPOSE… no
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.
参考:https://www.cnblogs.com/helloworld899/p/7813089.html
apt-get install libc-client-dev -y
如果 configure 报错:configure: error: Kerberos libraries not found.
configure: error: Kerberos libraries not found. Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr )
参考:https://www.cnblogs.com/helloworld899/p/7813089.html
apt-get install libkrb5-dev
【排错(CentOS)】
如果 configure 报错:checking for U8T_DECOMPOSE… no
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.
参考:https://amon.org/php-compile-errors
yum install libc-client-devel -y
如果没有这个包,可以手动安装:
下载: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
如果 configure 报错:
configure: error: OpenSSL libraries not found. Check the path given to --with-openssl-dir and output in config.log)
参考:https://www.cnblogs.com/wanglijun/p/9448349.html
寻找 libssl.so :
find / -name libssl.so
输出:
/usr/lib64/libssl.so
软连接:
ln -s /usr/lib64/libssl.so /usr/lib/libssl.so
参考:https://blog.phpgao.com/compile_php.html
参考:https://xvcat.com/post/1219
参考:https://www.cnblogs.com/reblue520/p/10181420.html
实证未遂。
【参考】
参考:https://bbs.csdn.net/topics/340269102
参考:https://timhbw.com/86.html
参考:https://www.awaimai.com/2120.html