php imap无法使用,php – imap_open()表示“无效的远程规范”并且无法连接

此博客讲述了开发者遇到的PHP imap_open错误,问题在于ssl选项后的尾随/,移除后即可解决问题。作者分享了具体实例和解决方法,适合PHP开发者参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

当我尝试使用imap_open时,我收到以下错误:

Warning: imap_open() [function.imap-open]: Couldn't open stream {mail.domain.com:110/pop3/novalidate-cert/} in /path/to/mailbox.php on line 5

Can't open mailbox {mail.domain.com:110/pop3/novalidate-cert/}: invalid remote specification

我的phpinfo说我有:

IMAP c-Client Version 2007e

SSL Support enabled

Kerberos Support enabled

在为imap提供相同phpinfo的另一台服务器上它可以工作,虽然那个版本是2006.PHP说它是用以下设置编译的:

'./configure' '--disable-path-info-check' '--enable-exif' '--enable-fastcgi' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--prefix=/usr' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-png-dir=/usr' '--with-sqlite=shared' '--with-ttf' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr'

解决方法:

看来,如果你在ssl或novalidate-cert之类的选项后面添加一个尾随/后一个,你会得到一个远程规范错误.删除尾随/,它的工作原理!

标签:php,imap

来源: https://codeday.me/bug/20190827/1740921.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值