PHP imap_open (): invalid remote specification when trying to connect to GMAIL

I try to get mail from Gmail and got the following error:

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

OpenSSL and IMAP are installed on my server, the following: openssl and 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'm really confused, please help!

+6
source share
2 answers

I had a similar problem. I can tell you from personal experience that although you may have IMAP and OpenSSL installed, you may need to recompile php install "--with-imap-ssl [= DIR]". I wanted to do the same and got the same error. I also had versions of OpenSSL and IMAP installed. I recompiled php and here is my configuration:

./configure --prefix = / usr / local / apache2 / php --with-imap = / usr / local / imap-2007f / - with-curl = / usr / local / curl / - enable- sockets - with-imap-ssl = / usr / local / ssl --with-openssl --with-apxs2 = / usr / local / apache2 / bin / apxs --with-kerberos --without-iconv

You do not need to use the same configuration, because it is configured for what I need.

If you are not familiar with php compilation, you can find the source here:
http://www.php.net/downloads.php
Here is a basic tutorial on compiling php and apache, assuming you are on UNIX. It also includes how to compile them with curl, you can use all the curling instructions and replace them with ssl and imap respectively, and it should work. http://thermo.sdsu.edu/testhome/phpinstall.html

+2
source
  $iconnect = imap_open("{imap.gmail.com:993/ssl/novalidate-cert}INBOX"," user@gmail.com ","passwordofuser") or die(imap_errors()); 

Check this code that will connect to the gmail server.

-1
source

Source: https://habr.com/ru/post/892959/


All Articles