Cannot Get IMAP Working - PHP5, Apache2 on Ubuntu

Hi

I have been trying to install and configure imap on my ubuntu server.

I log in as a root through Putty and then do the following:

sudo apt-get install php5-imap
Which now gives me:

Reading package lists… Done
Building dependency tree
Reading state information… Done
php5-imap is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Then a restart on the server:

apache2ctl graceful
After doing this I reload my PHPInfo file at http://www.testuber.co.uk/phpInfo/ and it still doesn’t show imap.

My IMAP script is

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

$imapHostname    = 'testuber.co.uk';
$imapUsername    = 'imaptest@testuber.co.uk';
$imapPassword    = '******';

$imapConnection    = imap_open('\\{'.$imapHostname.'/imap}INBOX', $imapUsername, $imapPassword) or die('Connection to server failed');

$imapHeaders    = imap_headers($imapConnection) or die('Couldn\\'t get emails');

$imapNumEmails    = sizeof($imapHeaders);

echo 'You have '.$imapNumEmails.' in your mailbox';
?>

and is located at http://www.testuber.co.uk/emailTest/ and it still shows

Fatal error: Call to undefined function imap_open() in /home/testuser/domains/testuber.co.uk/public_html/emailTest.php on line 9

Any help would be gratefully appreciated.

sd,

I’m confused. I thought imap was for e-mail, not a web server. Okay, okay, PHP does have imap extensions but

It looks like you did something quite different (i.e., you did not recompile PHP).

I’m moving you to the server board for better help.

Regards,

DK

Disclaimer: I haven’t used php-imap extensions.

Try completely stopping Apache, and looking for any child processes that still might be running:

ps -waux | grep “apache”

Sometimes, a child process that won’t quit can hold up Apache from fully restarting.