Php.cig with IMAP support

software development

#1

I’m trying to build my own php.cgi which supports the imap functions. If you have already built one, and would be willing to let others grab a copy, please let me know.

Ta,
Rhino


#2

Well, I succeeded in building my own. Great sence of satisfaction. I don’t know how many of the other modules work, as I’m only using this in one section of my site. None the less, when I have time, I’ll investigate further and build one that I can use for everything. At this stage though, I’m just chuffed that I got IMAP to work :slight_smile:

Rhino


#3

How did you manage that? I tried doing my own install of PHP5 but couldn’t get IMAP to install. I got confused having to install xxx first and then yyy second, I couldn’t get the first one to install ;_;


#4

You first need to download and compile the imap extension. I got my instructions from http://au.php.net/imap.

Once I’d done that, I followed the instructions from http://www.moztips.com/php5_install/, adding --with-imap=/path/to/imap/source/ to the php configure statement.

If you’re on jabber, send me your ID, and I’m happy to walk you through it when we’re both online. On the other hand, I’m happy to make a copy of my php.cgi available for download.

I should point out that I’m no expert at compiling software under *nix, just learning as I go.

Rhino


#5

How did you compile it may I ask? I tried to using Cygwin (for windows) but it didn’t work. I don’t have access to machine with Unix on it.
Could you link to the compiled libraries/files needed? I’m sure that we should be able to use the same files on DH servers?

I don’t have Jabber, but I have MSN.


#6

I used shell access to my dreamhost account (I hope that’s ok), so compiled it on the server that’s running the CGI, which I guess is the ideal situation.

As far as setting up a link, that’s possible I guess. I’ll check with the admin’s if that’s ok, otherwise we could simply put a copy into your home directory.

Use this as a guide, I just went through my history file and grabbed the commands that looked usefull :-S

#get and install the imap libraries
mkdir /home/yourhome/src
cd /home/yourhome/src
wget ftp://ftp.cac.washington.edu/imap/imap-2004e.tar.Z
tar -zxf imap-2004e.tar.Z
cd imap-2004e
make slx SSLTYPE=none
mkdir lib
mkdir include
cd c-client
cp *.h …/include/
cp *.c …/lib/
cp c-client.a …/lib/libc-client.a

#get the latest version of PHP and install
mkdir /home/yourhome/php
cd /home/yourhome/src

wget http://www.php.net/get/php-5.0.4.tar.gz/from/us2.php.net/mirror
gunzip php-5.0.4.tar.gz
tar -xf php-5.0.4.tar
cd php-5.0.4/

#add any extras you want compiled into the CGI.
./configure \ --prefix=/home/yourhome/php
–with-imap=/home/yourhome/src/imap-2004e \

make
make INSTALL


#7

I’ve put the process I used to get IMAP working up at…
http://outerpla.net/cms/archives/2

Hope it helps someone.
Lance


#8

I got mine to work by using DH wiki and the script provided by rhinosw. Thanks for the help.

For those who can’t connect, you should use

<?php $host = "{mail.domain.com:143/imap}"; //This is the name that appears in bold on the Mail->Addresses part of the DH panel. (It could be a lot of random numbers/letters $user = "user_name"; //Password for the account $pass = "password"; Btw Lance, why don't you use $HOME, and $DOMAIN (in the DH wiki) instead of /home/domain ? Makes it much more portable, especially if you recommend the script to others. $mbox = imap_open($host, $user, $pass); ?>

#9

Thanks decswxaqz,

I’ve updated the page to use $HOME