imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX
This error /can/ be missleading. I thought something was up with the stream (guessing there was a misconfiguration with PHP, IMAP and openSSL) – but it turned out I had typed the wrong password in the initial request.
Just incase anyone else is struggling here, just check that first.
Then, ensure you have installed the openSSL and the php5-imap extension correctly.