php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19987 supplied argument is not a valid imap resource.
Submitted: 2002-10-18 22:03 UTC Modified: 2002-10-19 07:35 UTC
From: root at blackdevil dot da dot ru Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.2.2 OS: Debian GNU Linux 3.0 woody
Private report: No CVE-ID: None
 [2002-10-18 22:03 UTC] root at blackdevil dot da dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-18 22:06 UTC] root at blackdevil dot da dot 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 23:58 UTC] rasmus@php.net
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.
 [2002-10-19 07:35 UTC] root at blackdevil dot da dot ru
Hello,

thanks a lot for your support! It was really script error - well, sometimes I look lide idiot ;-))). I've fixid it in such the way:

($mbox = imap_open($ConnStr, "root", "hellsoft")) || die ("can't connect: " . imap_last_error());

But on the provider server it works well and I think that works because of --enable-inline-optimization in config string.

Thanks a lot.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 11:01:27 2024 UTC