Installing IMAP 4.x for PHP 3.0.x with Apache 1.3.x on Red Hat Linux 5.x

by Nathan Wallace (August 9th, 1999)

Introduction

This document describes how to install IMAP support for PHP with Apache on Red Hat Linux.

Before we Begin

  1. These instructions assume that you have installed both Apache and PHP before. Here are my Apache installation instructions and those for PHP.

  2. Much of this installation requires root access. Let's change to the root user now.
        su
    

Getting IMAP

  1. You can download the latest version of IMAP from here. You should get the file called imap-4.6.BETA.tar.Z or similar. I am using imap-4.6.BETA.tar.Z for this installation.

  2. You can save this file to any location you like since we are just going to make the distribution and then copy out a few of the files. I saved it to /tmp. Here are the commands I typed during the session.
        cd tmp
        ftp ftp.cac.washington.edu
        cd imap
        ls
        get imap-4.6.BETA.tar.Z
        bye
    

Installing IMAP

  1. Uncompress and unpack the download.
        uncompress imap-4.6.BETA.tar.Z
        tar xvf imap-4.6.BETA.tar
    

  2. Now we have to compile it. For a standard Red Hat 5.x installation the slx directive to make will work. For other setups you should check the makefile for your required directive.
        cd imap-4.6.BETA
        make slx
    

  3. Now we need to install the libraries and include files into locations where they are in the link and include paths respectively for your system. I'll be using /usr/lib and /usr/include.
        cd c-client
        cp c-client.a /usr/lib
        cp rfc822.h mail.h linkage.h /usr/include
    

  4. The IMAP libraries are now installed on your machine.

Recompiling PHP

  1. I'm assuming you have installed PHP according to my instructions. They cover a fairly standard statically compiled (non-DSO) installation.

  2. If you have apache running on your machine you will need to stop it before recompiling PHP and Apache. You can stop Apache with:
        /www/bin/apachectl stop
    

  3. You need to reconfigure PHP to include support for IMAP. You basically just have to use the exact same configure line you used with your previous installation, but add the directive --with-imap to the end. Detailed instructions for this part are available here. I've just included the chain of commands below for your convenience. For my instructions with MySQL support this is:
        cd /usr/local/php
        ./configure --with-mysql=/usr/local/mysql --with-apache=../apache --enable-track-vars --with-imap
        make
        make install
        cd ../apache
        ./configure --prefix=/www --activate-module=src/modules/php3/libphp3.a
        make
        make install
    

  4. You should now have an Apache installation with PHP including IMAP support.

  5. Restart your Apache server with:
        /www/bin/apachectl start