IMAP error on localhost behind firewall?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

IMAP error on localhost behind firewall?

Post by alex.barylski »

I am trying to connect to GMail IMAP via my development server that sits behind a router using the following code:

Code: Select all

 
$mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "myemail@gmail.com", "mypassword")
     or die("can't connect: " . imap_last_error());
 
On my local server I get the following error:
2 - imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX - /var/www/index.php:44
can't connect: Certificate failure for imap.gmail.com: unable to get local issuer certificate: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=imap.gmail.com
However when I run this code on my shared server I get no errors and everything works hunk-dory... :|

I figured it was something to do with my router but what is it exactly? Anyone know? Am I missing something in the code? Is it because my computer maybe isn't configured to allow encrypted IMAP connections? How do I enable this if so?
Post Reply