Support Center » Knowledgebase » DWmail » How do I add IMAP support to PHP?
 How do I add IMAP support to PHP?
Solution

Whilst we do provide support for DWmail itself we can't provide personal support for your server configuration. Because of that we do give you a few tips on how to add IMAP support to PHP.

[Please note: configuring IMAP support will require you to have root access to your server AND will require changing core configuration files. We cannot be held responsible for any problems arising relating to the information given below. Always make sure you have a backup]

Throughout the information below you must replace the directory names with the location specific to your server setup.

Linux/Unix Based Systems - Compile from Binary

1) You have a Linux/Unix installation on Apache and your PHP installation is a binary installation from the PHP source.

a) Backup httpd.conf and libphp4.so in case anything goes wrong.

b) Get current PHP info. Create a PHP file (phpinfo.php, for example) in the http documents folder on your site. This file should contain:

code:
----------------------------------------------------------
<? phpinfo(); ?>
----------------------------------------------------------

When you view this file through your browser (ie., http://www.yourdomain.com/phpinfo.php ), it'll show you lots of information about the PHP installation on your server. Save the output to a local file so you can compare it to similar output after the upgrade.

c) Download and compile IMAP. This is used by DWmail, so it's required by PHP

code:
----------------------------------------------------------
cd /usr/local/src
wget ftp://ftp.cac.washington.edu/imap/imap.tar.Z
uncompress imap.tar.Z
tar xvf imap.tar
cd imap-2001a
make slx

----------------------------------------------------------

Also, copy the IMAP client header and lib files to appropriate places, as described at http://www.php.net/manual/en/ref.imap.php
:

code:
----------------------------------------------------------
cp /usr/local/src/IMAPDIRECTORY/c-client/c-client.a /usr/lib/libc-client.a
cp /usr/local/src/IMAPDIRECTORY/src/c-client/mail.h /usr/include
cp /usr/local/src/IMAPDIRECTORY/src/c-client/rfc822.h /usr/include
cp /usr/local/src/IMAPDIRECTORY/c-client/linkage.h /usr/include
export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"

----------------------------------------------------------

d) Download and recompile PHP

code:
----------------------------------------------------------
cd /usr/local/src
wget http://uk.php.net/get/php-4.3.4.tar.gz/from/www.php.net/mirror
tar xvfz php-4.3.4.tar.gz
cd php-4.3.4
./configure [CONFIGUREOPTIONS] --with-imap=/usr/local/src/IMAPDIRECTORY
make
make install

----------------------------------------------------------

The [CONFIGUREOPTIONS] here are based on what was displayed in the phpinfo before the upgrade. Feel free to add other options as you feel necessary. The IMAPDIRECTORY is the location of your previously installed IMAP c-client files.

e) Replace the PHP module used by Apache.

code:
----------------------------------------------------------
/path/to/apache/apachectl stop
cp -f /usr/local/src/php-4.3.4/.libs/libphp4.so /path/to/apache/libexec/
/path/to/apache/apachectl start
----------------------------------------------------------

f). View phpinfo again by visiting http://www.yourdomain.com/phpinfo.php ... It should now display the new version and other info for PHP.

g) Clean up any unnecessary files in /usr/local/src

Linux/Unix Based Systems - RPM

Some operating system providers distribute RPM installer files for PHP, these are not actually built by PHP themselves. Make sure you install the php-imap.rpm file as well

Windows Based Systems

Edit the php.ini file and uncomment the php-imap.dll line



Article Details
Article ID: 52
Created On: 15 Aug 2006 21:26

 This answer was helpful  This answer was not helpful

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | News | Downloads
Language:

Help Desk Software By Kayako SupportSuite v3.20.02
Copyright 1997-2008 Dominion Web All rights reserved. Privacy Policy.
Customer Support Area, Forums and Community Public and Customer Download Area DW:Design - Dominion Web DesignSoftware and Applications for the iPhone and iPod Touch Windows Applications and .NET Developer Components Dominion Web - Just imagine the possibilities Web Server Applications and Scripts