World-Three-Technologies / Masxaro-Prototype

Other
8 stars 4 forks source link

PHP imap_open error #20

Closed yaxing closed 13 years ago

yaxing commented 13 years ago

I'm trying to retrive mails from Gmail and got following error:

Can't open mailbox {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX: invalid remote specification

OpenSSL and IMAP are installed in my server, following are openssl & imap info from phpinfo();

OpenSSL OpenSSL support enabled OpenSSL Library Version OpenSSL 0.9.7l 28 Sep 2006 OpenSSL Header Version

imap

IMAP c-Client Version 2007e Kerberos Support enabled

I really appreciate if anyone can help me here.

Please refer to EmailCtrl::grabEmails($acc); (the code is not completed yet but should be enough for IMAPing the mailbox) For testing, please use proj/php/phpTest/emailTest.php. Test account : w3tAcc@masxaro.net pwd: 5f30ced61eed

Thank you.

ghost commented 13 years ago

I assume that the account at masxaro.net is configured to allow IMAP access (via ssl).

Quick search says it could be a firewall issue on box running PHP not allowing 993 http://davidwalsh.name/gmail-php-imap (search invalid remote specification)

Is PHP compiled with --with-imap-ssl? it may need --with-openssl <?php phpinfo() ?>

I 'searched' for this string and got a number of hits: how do I access gmail via imap from a php invalid remote specification

yaxing commented 13 years ago

In my phpinfo imap & ssl are both enabled. I think it might because that my port 993 is not open even though my firewall is turned off.

Following is the result of sudo lsof -i -P | grep -i "listen":

launchd 1 root 19u IPv6 0xffffff800bb83dd0 0t0 TCP localhost:631 (LISTEN) launchd 1 root 20u IPv4 0xffffff800bb86da8 0t0 TCP localhost:631 (LISTEN) launchd 1 root 101u IPv4 0xffffff800c1807b8 0t0 TCP :22 (LISTEN) launchd 1 root 107u IPv6 0xffffff800bb83ac0 0t0 TCP :22 (LISTEN) netsessio 228 yangcongknight 6u IPv4 0xffffff800bb84a08 0t0 TCP localhost:9421 (LISTEN) netsessio 228 yangcongknight 8u IPv4 0xffffff800bb855e8 0t0 TCP localhost:9422 (LISTEN) netsessio 228 yangcongknight 9u IPv4 0xffffff800bb84418 0t0 TCP localhost:9423 (LISTEN) Skype 24295 yangcongknight 34u IPv4 0xffffff800d270da8 0t0 TCP :1253 (LISTEN) ZendStudi 24422 yangcongknight 120u IPv6 0xffffff800bb82b70 0t0 TCP :6366 (LISTEN) ZendStudi 24422 yangcongknight 159u IPv6 0xffffff800bb809c0 0t0 TCP :9000 (LISTEN) ZendStudi 24422 yangcongknight 161u IPv6 0xffffff800bb83190 0t0 TCP :10137 (LISTEN) ZendStudi 24422 yangcongknight 196u IPv6 0xffffff800bb834a0 0t0 TCP :20080 (LISTEN) mysqld 24495 yangcongknight 10u IPv4 0xffffff800d136bd8 0t0 TCP :3306 (LISTEN) httpd 24501 root 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24501 root 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24509 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24509 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24510 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24510 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24511 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24511 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24512 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24512 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24513 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24513 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24514 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24514 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24519 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24519 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24521 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24521 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24671 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24671 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24674 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24674 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN) httpd 24675 yangcongknight 4u IPv6 0xffffff800bb81600 0t0 TCP :80 (LISTEN) httpd 24675 yangcongknight 7u IPv6 0xffffff800bb80cd0 0t0 TCP :443 (LISTEN)

I've been researching for a while, but I still don't know how to open a specific port on Mac, if anyone know this please help me, thanks!

ghost commented 13 years ago

I just logged on the account. It was NOT active and IMAP was not turned on.

So I accepted the account and then turned on IMAP.

Please test now.

We will need to figure out how to programmatically do this vs manual.

(LEAVING FOR COMPLETENESS) Did you check the links for any other helpful information?

Did you login to the account (in browser) and turn on IMAP support? By default I think it is turned off. I think there is a button to check for SSL also.

Can you connect w/ an IMAP client?

I have no idea why 993 should be open on your end. The reason you don't see it above is because you don't have a process listening on the port. So if there is no process listening it won't show up.

Instead from terminal telnet localhost 993 and see what happens. I expect a 'Connection refused'. You would also want to check from another computer and replace localhost w/ an IP.

System Settings -> Firewall I think there is a setting that allows all ports to connect. I don't have a Mac at the moment to check.

yaxing commented 13 years ago

I also think that I don't need to open port 993 on my computer....

I actually tested it using my own gmail account before, which is all set up including IMAP and SSL.

I checked out those links yesterday and tried those methods but still not working.

And yes telnet gave me Connection refused before, that's why I tried lsof from my own computer.

I'll do more research on this and try to make it work.

yaxing commented 13 years ago

Hey guys, would you mind trying /proj/php/phpTest/emailTest.php(branch backend)? On my server it's not responding at all, I just want to confirm is it the problem of my server, thank you!

yaxing commented 13 years ago

I think it's because I updated the SSL lib version from 0.9.7l 28 Sep 2006 to 0.9.8r 8 Feb 2011.