|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 00:00:02 2025 UTC |
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.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.