Results 1 to 3 of 3
Thread: PHP IMAP problems
Hybrid View
-
12-16-2004, 04:01 PM #1New Member
- Join Date
- Dec 2004
- Posts
- 1
PHP IMAP problems
Fatal error: Call to undefined function: imap_open() in xxxx
I have found many occurances of this problem through Google but no resolution. Basically my script is returning the above fatal error which says to me that IMAP is not installed, which is the same opinion of most other programmers around the Net. However IMAP is installed - I even have SquirrelMail, Horde IMP & NeoMail installed on the server...all working fine.
Anyone have any other ideas as to why this doesn't work?
The code is below, a sample script from the php.net site.
PHP Code:$mbox = imap_open ("{mail.farstate.com:143}", "farcom", "firestor");
echo "<p><h1>Mailboxes</h1>\n";
$folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*");
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);
-
12-16-2004, 04:41 PM #2Aspiring Evangelist
- Join Date
- Jun 2003
- Location
- Ukiah, California
- Posts
- 394
Looks like maybe you don't have imap support compiled into php. Perhaps a recompile is in order?
Jacob Turner -- Ringnebula Systems
Managed IT solutions for small business
-
12-16-2004, 05:12 PM #3WHT Addict
- Join Date
- Nov 2003
- Location
- Netherlands
- Posts
- 164
sounds like php itself doesnt have it installed..maybe you didnt enable the extensions for php..
for linux server
--------
re-compile PHP with imap, include --with-imap in the arguments. you probaably need the imap libs and include files too for this.
quote from php.net:
'' To get these functions to work, you have to compile PHP with --with-imap[=DIR], where DIR is the c-client install prefix. From our example above, you would use --with-imap=/usr/local/imap-2000b. This location depends on where you created this directory according to the description above. Windows users may include the php_imap.dll DLL in php.ini ''
for windows server
--------
edit the php.ini and remove ';' from the line:
;extension=php_imap.dll
also you might need to copy the php_imap.dll into the /php and /system32 folder to get it to load.