#27017 [Ana]: imap_open() fails when php is built with ssl

From: Date: Fri, 23 Jan 2004 07:56:43 +0000
Subject: #27017 [Ana]: imap_open() fails when php is built with ssl
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969358400@lists.php.net to get a copy of this message
ID: 27017 User updated by: jjb at bcc dot com Reported By: jjb at bcc dot com Status: Analyzed Bug Type: Documentation problem Operating System: solaris 9 PHP Version: Irrelevant New Comment: thanks for the docs! i changed "localhost" to match the name in the cert. next, php barks when the cert is self-signed, so i used a couple of the flags. imap_open("{alpha.bcc.com:143/imap4rev1/novalidate-cert}INBOX",... this is working. thanks for the help! Previous Comments: ------------------------------------------------------------------------ [2004-01-23 02:50:59] sniper@php.net Correct remote name in your case is: {localhost:143/notls}INBOX ------------------------------------------------------------------------ [2004-01-23 02:39:21] sniper@php.net This is actually documentation problem. When imap extension is build with SSL support, the connection defaults to using SSL.. All the additional protocol specfications should be described on imap_open() page, here's cut'n' paste from the c-client docs (naming.txt): III. Remote names All names which start with "{" are remote names, and are in the form "{" remote_system_name [":" port] [flags] "}" [mailbox_name] where: remote_system_name Internet domain name or bracketed IP address of server. port optional TCP port number, default is the default port for that service flags optional flags, one of the following: "/service=" service mailbox access service, default is "imap" "/user=" user remote user name for login on the server "/authuser=" user remote authentication user; if specified this is the user name whose password is used (e.g. administrator) "/anonymous" remote access as anonymous user "/debug" record protocol telemetry in application's debug log "/secure" do not transmit a plaintext password over the network "/imap", "/imap2", "/imap2bis", "/imap4", "/imap4rev1" equivalent to /service=imap "/pop3" equivalent to /service=pop3 "/nntp" equivalent to /service=nntp "/norsh" do not use rsh or ssh to establish a preauthenticated IMAP session "/ssl" use the Secure Socket Layer to encrypt the session "/validate-cert" validate certificates from TLS/SSL server (this is the default behavior) "/novalidate-cert" do not validate certificates from TLS/SSL server, needed if server uses self-signed certificates "/tls" force use of start-TLS to encrypt the session, and reject connection to servers that do not support it "/notls" do not do start-TLS to encrypt the session, even with servers that support it "/readonly" request read-only mailbox open (IMAP only; ignored on NNTP, and an error with SMTP and POP3) mailbox_name remote mailbox name, default is INBOX For example: {imap.foo.com}INBOX opens an IMAP connection to system imap.foo.com and selects INBOX. ------------------------------------------------------------------------ [2004-01-23 02:33:26] jjb at bcc dot com alpha# php /tmp/login.php Warning: imap_open(): Couldn't open stream {localhost:143}INBOX in /tmp/login.php on line 5 Notice: (null)(): Certificate failure for localhost: Server name does not match certificate: /C=US/ST=California/L=Solana Beach/O=BCC/OU=Internet Mail and Web Services/CN=alpha.bcc.com (errflg=2) in Unknown on line 0 ------------------------------------------------------------------------ [2004-01-23 02:29:29] sniper@php.net Add this as first line in your script: error_reporting(E_ALL); And check what errors you get then. ------------------------------------------------------------------------ [2004-01-23 02:10:38] jjb at bcc dot com this is the configure command for php: ./configure \ --enable-discard-path \ --enable-force-cgi-redirect \ --enable-ftp \ --enable-shared \ --enable-sockets \ --enable-static \ --enable-sysvsem \ --enable-sysvshm \ --enable-track-vars \ --with-apache2 \ --with-apxs2=/usr/local/apache2/bin/apxs\ --with-bz2=/usr/local \ --with-gdbm=/usr/local \ --with-gettext=/usr/local \ --with-imap-ssl=/usr/local/ssl \ --with-imap=/var/src/mail/imap-2004.RC4 \ --with-iodbc=/usr/local \ --with-jpeg-dir=/usr/local \ --with-ldap=/usr/local/openldap \ --with-mysql=/usr/local/mysql \ --with-ncurses=/usr/local \ --with-openssl=/usr/local/ssl \ --with-png-dir=/usr/local \ --with-readline \ --with-thread-safe-client \ --with-zlib-dir=/usr/local here's the command to build uw-imap: make gso PASSWDTYPE=pmb SSLTYPE=unix ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/27017 -- Edit this bug report at http://bugs.php.net/?id=27017&edit=1

« previous php.doc (#969358400) next »