1.环境
系统:CentOS
PHP:php 7.2.26 (使用lnmp1.6安装)
2. 过程(以imap为例)
- 安装impa所需依赖
yum -y install libc-client-*
- 进入lnmp的src下目录(以下是我的目录)
cd ~/lnmp1.6/src
- 解压php(注意版本要与使用的版本一致)
tar -xjvf php-7.2.26.tar.bz2
- 安装imap
cd php-7.2.26/ext/imap
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap-ssl
make && make install
- 修改php配置文件,加载imap,去掉;extension=imap前面的分号(915行)
vi /usr/local/php/etc/php.ini
extension=imap
- 重启apache
service httpd restart
- 在<?php phpinfo();?> 或者是 php -m 命令中能够看到加载了扩展
3.常见问题
- configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
解决办法:
yum install -y libc-client-devel
- configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
解决办法:
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
系统找不到libc-client,做一个软连接,就解决了,可能路径要修改