#19987 [Opn->Bgs]: supplied argument is not a valid imap resource.

From: Date: Sat, 19 Oct 2002 04:58:49 +0000
Subject: #19987 [Opn->Bgs]: supplied argument is not a valid imap resource.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22821@lists.php.net to get a copy of this message
ID: 19987 Updated by: rasmus@php.net Reported By: root@blackdevil.da.ru -Status: Open +Status: Bogus Bug Type: IMAP related Operating System: Debian GNU Linux 3.0 woody PHP Version: 4.2.2 New Comment: This is not a bug. Your error handling is wrong. || die() after your imap_open() call is going to end up putting a boolean into $mbox. You need the lower precedence OR operator. Change that line to be: $mbox = imap_open($ConnStr, "csb", "masd123") OR die ("can't connect: " . imap_last_error()); and I bet it will work just fine. Previous Comments: ------------------------------------------------------------------------ [2002-10-18 22:06:45] root@blackdevil.da.ru P.S. IMAP package was compiled using "make slx". PHP is bound to apache via APXS. Apache version: 1.3.26. And the same situation I relive on Windows XP with the same version of Apache and PHP. php_imap.dll was added to PHP.INI and will be loaded (was tested through process module list). I've tested enought software like NOCC using imap and no one package did worked. ------------------------------------------------------------------------ [2002-10-18 22:03:07] root@blackdevil.da.ru Hello, I'm trying to use IMAP module under PHP. I've written the simple script which works well on the server of my ISP but when I try to launch it on my own system (Debian GNU Linux 3.0 woody) I always get "supplied argument is not a valid imap resource". There is no matter which statements do I use: imap_check, imap_close or anything other. imap_open() establishes POP3 connection as well. But any further requests fail. ./configure --prefix=/srv/php --with-apxs=/srv/apache/bin/ --with-imap=/arch/build/imap-2003.RC3 I've already tried to config & compile it with libc-client distributed with Debian. There is no difference. It produces always the same error. Here is my test script (taken from imap_open() notes): <?PHP $ConnStr="{192.168.0.1:110/pop3}INBOX"; $mbox = imap_open($ConnStr, "my_login_name", "my_password") || die ("can't connect: " . imap_last_error()); echo "<p><h1>Mailboxes</h1>\n"; $folders = imap_listmailbox ($mbox, $ConnStr, "*"); if ($folders == false) { echo "Call failed<br>\n"; } else { while (list ($key, $val) = each ($folders)) { echo $val."<br>\n"; } } echo "<p><h1>Headers in INBOX</h1>\n"; $headers = imap_headers ($mbox); if ($headers == false) { echo "Call failed<br>\n"; } else { while (list ($key,$val) = each ($headers)) { echo $val."<br>\n"; } } imap_close($mbox); ?> Following does it reply so far i call it from browser: Warning: imap_check(): supplied argument is not a valid imap resource in /home/serve/public_html/imap.php on line 7 imap_check() failed: Warning: imap_close(): supplied argument is not a valid imap resource in /home/serve/public_html/imap.php on line 25 Thanks & regards ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19987&edit=1

« previous php.bugs (#22821) next »