Mac OS X Mavericks:PHP错误"imap_open()[function.imap-open]:无法打开流" [英] Mac OS X Mavericks: PHP error "imap_open() [function.imap-open]: Couldn't open stream"

查看:82
本文介绍了Mac OS X Mavericks:PHP错误"imap_open()[function.imap-open]:无法打开流"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用imap_open函数时遇到问题.看来我的连接在Mac OS X上不起作用,我也不知道为什么.如果我在Windows(我正在使用WAMP)上进行尝试,它将按预期工作,而不会出现任何问题.如果我在Mac OS X Mavericks上尝试完全相同代码,似乎出现以下错误:

I have an issue with imap_open function. It seems that my connection doesn't work on Mac OS X and I don't know why. If I try it on Windows (I am using WAMP), it works as expected without any issues. If I try the exact same code on Mac OS X Mavericks, it seems that I have the following error:

Warning: imap_open() [function.imap-open]: Couldn't open 
stream {XXX.co.uk:993/imap/ssl}INBOX in XXX.php on line XXX

该代码是与imap_open的简单连接,您可以在下面看到我的代码:

The code is a simple connection with imap_open, you can see my code below:

$host = 'XXX.co.uk:993/imap/ssl';
$username = 'XXX';
$password = 'XXX';

$mailbox = '{'.$host.'}INBOX';
imap_open($mailbox , $username , $password);

如果那很重要,对于Mac OS X Mavericks,我正在使用MAMP.

If that matters, for Mac OS X Mavericks I am using MAMP.

我不知道为什么会这样.也许端口阻止了Mac OS X?如果这是问题,可以请您帮我解决这个问题吗?例如,如何为PHP和Mac OS X启用993端口?

I don't have a clue of why this is happening. Maybe a port blocking from Mac OS X? If this is the problem, can you please help me to solve this issue? How can I for example enable the 993 port for PHP and Mac OS X?

推荐答案

最后,我找到了解决问题的方法.

Finally, I've found a solution for my problem.

我真的不知道为什么会这样,作为最后的选择,我确实通过 Vagrant .我知道这可能无助于了解问题所在,但至少可以解决其他人的问题.我意识到,安装一个Vagrant的速度要快得多,而不是查找为什么会发生这种情况. Puphpet 网站上的在线向导选择了IMAP作为扩展,这帮助我解决了我的问题.我希望这对我的问题也能帮助其他人.

I really couldn't found why this is happening and as a last resort I did install a Virtual Machine through Vagrant. I know that this maybe doesn't help to understand where the problem is but at least it may solve the problem of someone else. I realized that it was much faster to install a Vagrant rather than searching of why this is happening. An online wizard at Puphpet website with choosing the IMAP as an extension helped me to solve my problem. I hope this can help others as well with the same issue as mine.

我确实尝试了几种方法,例如通过CLI使用imap和其他一些东西重新编译PHP而不使用MAMP来安装PHP,但这对我不起作用.

I did try several things, like install PHP through CLI by recompiling it with imap and some other stuff without using MAMP and it didn't work for me.

这篇关于Mac OS X Mavericks:PHP错误"imap_open()[function.imap-open]:无法打开流"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆