Php & Imap

tino

Verified User
Joined
Jan 8, 2004
Messages
92
Hi,

I'm thinking of recompiling PHP to include, for example, the IMAP modules.

Has onyone done this (and succeeded)?

I've got a few Ensim servers, and recompiling PHP on those boxes it kinda hard; especially since after that most upgrades won't work any more. :-(

Any ideas on this issue?

Tino
 
Last edited:
The DA customapache script does this very easily for you.

Check out /usr/local/directadmin/customapache

./build and ./configure.php
 
These files appear to be holding the info I need.
But I really would like some info on how to modify these. (For example; what do the version numbers do?)

I could simply add the required --with-imap=/usr/local/imap-2000e to the compile statement in configure.php;
'./configure' '--with-apxs' '--with-curl' '--with-curl-dir=/usr/local/lib' '--with-gd' '--with-gd-dir=/usr/local/lib' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-kerberos' '--with-mcrypt' '--with-mysql' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-xml' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-track-vars'

Would this be sufficient? Do I recompile PHP simply by running ./configure.php?

Sould I compile and install c-client and imap-2000e before running configure.php?

(There are some issues with the imap-2000e install, you should not copy the imap files to the system include directory, since there may be conflicts. See www.php.net, and search for IMAP in the functions list for more info.)

thanks!

Tino
 
Okay, I did it.

This is what I did;

I downloaded the c-client and installed it. Since I'm on a RH9 box, this is the make command for the c-client:

make lrh EXTRACFLAGS=-I/usr/kerberos/include EXTRALDFLAGS=-I/usr/kerberos/lib

I've create a directory /usr/local/imap-2000e and created a /lib and /include directory in it.

I copied all files to the proper directory (including c-client.a to lib/libc-client.a)

I change the compile options in configure.php. I added:
--with-imap=/usr/local/imap-2000e

Then I did a ./build php without rebuilding everything that was already on the system.

Then I restarted apache, just to be safe. :)

That did the trick!

I hope IMAP won't be disabled in future updates....

Thanks for the info!

Tino
 
tino said:
I change the compile options in configure.php. I added:
--with-imap=/usr/local/imap-2000e

Then I did a ./build php without rebuilding everything that was already on the system.

Then I restarted apache, just to be safe. :)

That did the trick!

I hope IMAP won't be disabled in future updates....

Thanks for the info!

Tino

Well, Personally i recommend to backup the configure.php and apache files, because when there is a new version everyone starts trying what someone else has posted on the forums without knowing what the rm configure.php exactly does, at least, i said something about it before :D

DirectAdmin doesn't automatically recompile apache or php (or any hosting related stuff besides itsself, as far as i know), only when installing new modules it tends to use the rpm command (or does it accually compile ?)

Every time the custombuilder is used you need to restart apache to get the new stuff to work.
 
Hello,

DirectAdmin doen't touch that stuff once installed :) And yes, all apache related things are compiled.

John
 
anychance of an idiots guide to this? Where did you get c-client? etc etc

Thanks in advance
 
Hi,

Yes, I can give you a small "HOWTO":

1) Download the c-client: ftp://ftp.cac.washington.edu/imap/c-client.tar.Z in a directory of your liking, for example your home directory. I will assume you download the file in you current directory.
2) Extract the c-client: tar -zxvf c-client.tar.Z
3) Enter the c-client source directory: cd imap-2002e (Of course, the directory name can vary if you extracted the client to another directory, or a new release comes available. At this moment 2002e is the latest stable version, but there is a 2004 beta.)
4) Check the file Makefile to see how you should "Make" the c-client. (Look in Makefile and find your system type code. For example, modern versions of Linux will use either "slx", "lnp", "lrh", or "lsu".)
5) "Make" the c-client, for example: make slx
NOTE: If you run RedHat 9, use this command:
make lrh EXTRACFLAGS=-I/usr/kerberos/include EXTRALDFLAGS=-I/usr/kerberos/lib
6) It's important that you do not copy the IMAP source files directly into the system include directory as there may be conflicts. Instead, create a new directory inside the system include directory, such as /usr/local/imap-2000e/ (location and name depend on your setup and IMAP version), and inside this new directory create additional directories named lib/ and include/. From the c-client directory from your IMAP source tree, copy all the *.h files into include/ and all the *.c files into lib/. Additionally when you compiled IMAP, a file named c-client.a was created. Also put this in the lib/ directory but rename it as libc-client.a.
7) Change the configure.php in /usr/local/directadmin/customapache. Add this line:
--with-imap=/usr/local/imap-2000e
at the end of the configure statement. Remember to add a "\" to the previous line. The configure statement should look like this:
PHP:
./configure \
        --with-apxs \
        --with-curl \
        --with-curl-dir=/usr/local/lib \
        --with-gd \
        --with-gd-dir=/usr/local/lib \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-kerberos \
        --with-mcrypt \
        --with-mysql \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-xml \
        --with-zlib \
        --with-zlib-dir=/usr/local/lib \
        --enable-bcmath \
        --enable-calendar \
        --enable-ftp \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-track-vars \
        --with-imap=/usr/local/imap-2000e
It is at the top of the configure.php file.
8) Recompile PHP. Go to /usr/local/directadmin/customapache and type: ./build php Do not rebuild the stuff that PHP uses; it's allready on your system and doesn't need recompiling.
9) Restart the Apache Web Server (from the DirectAdmin Control Panel, or /etc/init.d/httpd restart).

I know that this could be done nicer if you place the entire process of installing the c-client to your server in the build file. But since you have to do some copying and renaming in the c-client libraries (see point 6) I did it the way I mentioned above.

Well, this small HOWTO should enable everyone to install IMAP support in PHP.

You can use the phpinfo() command to see if it all worked.

And euh... Don't blame me if you brake your server. :) Should be pretty safe though!

Tino
 
Last edited:
I am now getting this when i build php



Thank you for using PHP.

/usr/local/directadmin/customapache/configure.php: line 19: --enable-bcmath: command not found

*** There was an error while trying to configure php. Check the configure.php file
 
I guess you added the --with-imap=/usr/local/imap-2000e line below the other "--with..." lines?

Did you terminate that new line with a "\" (like the rest)?

it should read:

--with-imap=/usr/local/imap-2000e \

All lines in the configure statement should end with "\", except the last one.

Tino
 
below is my configure.php

#!/bin/sh
./configure \
--with-apxs \
--with-curl \
--with-curl-dir=/usr/local/lib \
--with-gd \
--with-gd-dir=/usr/local/lib \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
--with-kerberos \
--with-mcrypt \
--with-mysql \
--with-pear \
--with-png-dir=/usr/local/lib \
--with-xml \
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-track-vars \
--with-imap=/usr/local/imap-2000e \
 
Change

--with-imap=/usr/local/imap-2000e \

to

--with-imap=/usr/local/imap-2000e

That should fix your problem. By keeping \ at the end, the configure script is going to think there's another flag coming after --with-imap.
 
i then get the below

Thank you for using PHP.

/usr/local/directadmin/customapache/configure.php: line 19: --enable-bcmath: command not found
/usr/local/directadmin/customapache/configure.php: line 24: --with-imap=/usr/local/imap-2000e: No such file or directory

*** There was an error while trying to configure php. Check the configure.php file
 
It seems you did not install the c-client in the directory you mention in the configure.php script.

Did you correctly copy the c-client files?

Tino
 
this is my complete customapache\configure.php file

#!/bin/sh
./configure \
--with-apxs \
--with-curl \
--with-curl-dir=/usr/local/lib \
--with-gd \
--with-gd-dir=/usr/local/lib \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
--with-kerberos \
--with-mcrypt \
--with-mysql \
--with-pear \
--with-png-dir=/usr/local/lib \
--with-xml \
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-track-vars \
--with-imap=/usr/local/imap-2000e

/usr/local/imap-2000e contains only the 2 directorys

/include and /lib

both of which are listed below

LIB

auth_gss.c ckp_pam.c flockcyg.c kerb_mit.c memmove.c os_a41.c os_do4.c os_s40.c rename.c strtoul.c
auth_log.c ckp_pmb.c flocksim.c koi8_r.c memset.c os_aix.c os_drs.c os_sc5.c rfc822.c tcp_unix.c
auth_md5.c ckp_psx.c flstring.c koi8_u.c mh.c os_aos.c os_dyn.c os_sco.c scandir.c tenex.c
auth_pla.c ckp_sec.c fs_unix.c ksc_5601.c misc.c os_art.c os_hpp.c os_sgi.c setpgrp.c tis_620.c
auths.c ckp_ssn.c fsync.c libc-client.a mmdf.c os_asv.c os_isc.c os_shp.c sig_bsd.c truncate.c
big5.c ckp_std.c ftl_unix.c linkage.c mtx.c os_aux.c os_lnx.c os_slx.c siglocal.c tz_bsd.c
ckp_1st.c ckp_sv4.c gb_12345.c log_bsi.c mx.c os_bsd.c os_lyn.c os_sol.c sig_psx.c tz_nul.c
ckp_2nd.c ckp_svo.c gb_2312.c log_cyg.c netmsg.c os_bsf.c os_mct.c os_sos.c sig_sv4.c tz_sv4.c
ckp_3rd.c ckp_ult.c gethstid.c log_old.c news.c os_bsi.c os_mnt.c os_sun.c smanager.c unix.c
ckp_a41.c cns11643.c gr_wait4.c log_os4.c newsrc.c os_cvx.c os_nto.c os_sv2.c smtp.c utf8.c
ckp_afs.c crexcl.c gr_wait.c log_sec.c nfstest.c os_cyg.c os_nxt.c os_sv4.c ssl_none.c utime.c
ckp_bsi.c crx_nfs.c gr_waitp.c log_std.c nfstnew.c osdepbas.c os_os4.c os_ult.c sslstdio.c viscii.c
ckp_cyg.c crx_std.c ibm.c log_sv4.c nfstold.c osdep.c os_osf.c os_vu2.c ssl_unix.c windows.c
ckp_dce.c dummy.c imap4r1.c mail.c nl_unix.c osdepckp.c os_osx.c phile.c strerror.c write.c
ckp_gss.c env_unix.c iso_8859.c mbox.c nntp.c osdeplog.c os_ptx.c pmatch.c strpbrk.c
ckp_nul.c fdstring.c jis_0208.c mbx.c opendir.c osdepssl.c os_pyr.c pop3.c strstr.c
ckp_os4.c flcksafe.c jis_0212.c memmove2.c os_a32.c os_d-g.c os_qnx.c pseudo.c strtok.c


INCLUDE

c-client.h flstring.h mbx.h news.h os_aos.h os_cvx.h os_hpp.h os_nxt.h os_s40.h os_sos.h pop3.h tenex.h
dummy.h fs.h mh.h newsrc.h os_art.h os_cyg.h os_isc.h os_os4.h os_sc5.h os_sun.h pseudo.h unix.h
env.h ftl.h misc.h nl.h os_asv.h osdep.h os_lnx.h os_osf.h os_sco.h os_sv2.h rfc822.h utf8.h
env_unix.h imap4r1.h mmdf.h nntp.h os_aux.h os_d-g.h os_lyn.h os_osx.h os_sgi.h os_sv4.h smtp.h
fdstring.h linkage.h mtx.h os_a32.h os_bsd.h os_do4.h os_mct.h os_ptx.h os_shp.h os_ult.h sslio.h
flockcyg.h mail.h mx.h os_a41.h os_bsf.h os_drs.h os_mnt.h os_pyr.h os_slx.h os_vu2.h tcp.h
flocksim.h mbox.h netmsg.h os_aix.h os_bsi.h os_dyn.h os_nto.h os_qnx.h os_sol.h phile.h tcp_unix.h
 
Hmm... That all looks pretty okay to me.

I have no clue what goes wrong.

If you remove the "--with-imap" line from the configure.php script, are you able to recompile php then?

Tino
 
thanks for your help if i change it back i still get this error

/usr/local/directadmin/customapache/configure.php: line 19: --enable-bcmath: command not found

*** There was an error while trying to configure php. Check the configure.php file
 
I think you need to get this one sorted out first.

Since bcmatch doesn't need to be compiled or anything (it's just a PHP option) the real error might be the line above.

Could it be you have used a "strange" editor? Open the file in vi and see if there are any strange characters at the end of the previous line... I'm not sure if that is the problem, but I really would have no other idea.

Tino
 
I used vi and i have just checked it with pico and there are no extra charachers...
 
Back
Top