PHP加载IMAP模块问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP加载IMAP模块问题相关的知识,希望对你有一定的参考价值。
用php调用imap_open()出现PHP Fatal error:Call to undefined function imap_open()
php.ini设置:
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
更改后重启了Apache,ext下有文件php_imap.dll
phpinfo()正常:
IMAP c-Client Version 2004
SSL Support enabled
请问该怎么做啊
用get_extension_funcs("imap"); 函数进行测试,若返回boolean值为空,说明php_imap.dll文件没有加载进去, 参考技术A 重新配置EclipsePHP调试的路径
明显是路径不对嘛本回答被提问者采纳
centos6和centos7手动扩展PHP的IMAP模块
一、centos6.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编译即可。 |
二、centos7.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模块了
本文出自 “M四月天” 博客,请务必保留此出处http://msiyuetian.blog.51cto.com/8637744/1896805
以上是关于PHP加载IMAP模块问题的主要内容,如果未能解决你的问题,请参考以下文章
已安装 PHP IMAP 但出现“未定义的函数 imap_open()”错误
安装iamp模块,编译报错configure: error: Cannot find imap library (libc-client.a). Please check your c-client