Php & Imap

streamservice said:
Is there an option to change something in the php.ini to enable IMAP whitout recompiling it?

OS: debian 3.1
Controlpanel: DirectAdmin (offcourse)
No, you need the IMAP API symbols available, and to get those, it needs to be linked to the IMAP client library. And the hooks to use that library need to be turned on, which happens during the build phase.
 
What to do?


checking for iconv support... no
checking for IMAP support... yes
checking for IMAP Kerberos support... yes
checking for IMAP SSL support... no
checking for pam_start in -lpam... yes
checking for crypt in -lcrypt... yes
configure: error: Kerberos libraries not found.

Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr )


*** There was an error while trying to configure php. Check the configure.php file
It looks like this is all a 64bit<->32bit incompatibility.
On my 64bit CentOS boxes, none of them have either a /usr/kerberos/lib or /usr/kerberos/lib64 folder.

Installing the original 64bit c-client lib by running:

up2date -u libc-client* does install the libc-client.a, but the php configuration cannot find it, as it appearently only checks for a 32 bit version.

Disabling --with-kerberos does compile, but gives me a link error in relocation of 64 to 32 bit in libc-client.a, the one build from the DA file.

Even when installing both kerberos 5 64bit and 32bit libraries, the php configuration seems unable to find them when enabling imap.

Without IMAP enabled, ldd /usr/local/bin/php clearly shows that kerberos 5 IS installed and linked to corectly:

libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00000030ab200000)
libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00000030aad00000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00000030aab00000)
libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00000030ab400000)

Maybe it's all just a bug in PHP with the new IMAP ?

Why did they change IMAP to need libc-client anyways, while it has worked before without this?
 
Last edited:
Get PHP+IMAP compiling on 64bit

In order to get the PHP IMAP extention to compile correctly, just manually add the libc-client like written in a previous post.

On CentOS 64bit, you then get an error regarding kerberos5.

To solve this, remove the configure option --with-kerberos
and add:

--enable-pic

It might also helptto add the option:

--with-libdir=lib64

EDIT: It seems you also need to compile c-client with PIC enambled.
To do this, edit the Makefile. Change these lines:

#EXTRACFLAGS= DA CHANGED
EXTRACFLAGS=-I/usr/kerberos/include -L/usr/kerberos/lib

To:

#EXTRACFLAGS= DA CHANGED
EXTRACFLAGS=-I/usr/kerberos/include -L/usr/kerberos/lib -fPIC
 
Last edited:
I'm not sure if people are still having problems with this, but life has become much easier over the last few years... :-)

If you have CentOS or something you dan do this;

yum install libc-client
yum install libc-client-devel

in the configure.php don't add --with-imap=/bla/bla but this:

--with-imap-ssl \
--with-imap

that's all...

Oh yeah, if you are running 64bits, you need the -fPIC like stated earlier.

Tino
 
Last edited:
I'm not sure if people are still having problems with this, but life has become much easier over the last few years... :-)

If you have CentOS or something you dan do this;

yum install libc-client
yum install libc-client-devel

in the configure.php don't add --with-imap=/bla/bla but this:

--with-imap-ssl \
--with-imap

that's all...

Oh yeah, if you are running 64bits, you need the -fPIC like stated earlier.

Tino

Tino,

Thank you so much. This helps a lot!

Best regards,

Reyner Natahamidjaja
 
/usr/local/directadmin/customapache/configure.php: line 30: --with-imap-ssl: command not found

*** There was an error while trying to configure php. Check the configure.php file
 
/usr/local/directadmin/customapache/configure.php: line 30: --with-imap-ssl: command not found

*** There was an error while trying to configure php. Check the configure.php file

Can you post the whole contents of your configure.php(_ap2) file?
I expect you are missing a trailing '\' somewhere
 
its okay. i sloved


REMEMBER TO ADD A \ IN THE LAST LINE OF CONFIGURE.PHP BEFORE ADDING THE 2 LINES.

AND A MUST TO RESTART HTTPD.
 
I'm not sure if people are still having problems with this, but life has become much easier over the last few years... :-)

If you have CentOS or something you dan do this;

yum install libc-client
yum install libc-client-devel

in the configure.php don't add --with-imap=/bla/bla but this:

--with-imap-ssl \
--with-imap

that's all...

Oh yeah, if you are running 64bits, you need the -fPIC like stated earlier.

Tino


This works flawlessly running CentOS 5.1 with Apache2 and the custombuild script for DirectAdmin. Thank you!
 
Need some ideas

I've done this before, but this one is unusual...

I have a customer running DA, CentOS 4.6 64-bit.

After attempting to rebuild kerberos/imap a bit as was done in the initial posts in this thread, I've resorted to installing the libraries provided by yum, libc-client, and libc-client-devel

Both libraries are installed, and my configure command is successful.

When attempting to issue "make" after the fact however, the system farts on /usr/include/imap/unix.h because MAILSTREAM is not defined (seems it is defined in mail.h, but is never included..)

Configure command (config command is in phpcompile)
[root@srv04 php-5.2.6]# ./phpcompile 2>&1 | grep IMAP
checking for IMAP support... yes
checking for IMAP Kerberos support... yes
checking for IMAP SSL support... yes
checking whether build with IMAP works... yes


The exact compiler output is:
[root@srv04 php-5.2.6]# make
/bin/sh /devel/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/libxml/ -I/devel/php-5.2.6/ext/libxml/ -DPHP_ATOM_INC -I/devel/php-5.2.6/include -I/devel/php-5.2.6/main -I/devel/php-5.2.6 -I/usr/include/libxml2 -I/usr/local/include -I/usr/kerberos/include -I/devel/php-5.2.6/ext/date/lib -I/usr/include/freetype2 -I/usr/include/imap -I/devel/php-5.2.6/ext/mbstring/oniguruma -I/devel/php-5.2.6/ext/mbstring/libmbfl -I/devel/php-5.2.6/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/devel/php-5.2.6/TSRM -I/devel/php-5.2.6/Zend -I/usr/include -g -O2 -c /devel/php-5.2.6/ext/libxml/libxml.c -o ext/libxml/libxml.lo
In file included from /devel/php-5.2.6/Zend/zend.h:72,
from /devel/php-5.2.6/main/php.h:34,
from /devel/php-5.2.6/ext/libxml/libxml.c:28:
/usr/include/imap/unix.h:182: error: syntax error before "MAILSTREAM"
/usr/include/imap/unix.h:182: warning: no semicolon at end of struct or union
/usr/include/imap/unix.h:189: error: syntax error before '}' token
/usr/include/imap/unix.h:189: warning: data definition has no type or storage class
/usr/include/imap/unix.h:193: error: syntax error before '*' token
/usr/include/imap/unix.h:193: warning: data definition has no type or storage class
/usr/include/imap/unix.h:196: error: syntax error before '*' token
/usr/include/imap/unix.h:197: error: syntax error before '*' token
/usr/include/imap/unix.h:198: error: syntax error before '*' token
/usr/include/imap/unix.h:199: error: syntax error before '*' token
/usr/include/imap/unix.h:200: error: syntax error before '*' token
/usr/include/imap/unix.h:201: error: syntax error before '*' token
/usr/include/imap/unix.h:202: error: syntax error before '*' token
/usr/include/imap/unix.h:202: error: syntax error before '*' token
/usr/include/imap/unix.h:202: warning: data definition has no type or storage class
/usr/include/imap/unix.h:203: error: syntax error before '*' token
/usr/include/imap/unix.h:204: error: syntax error before '*' token
/usr/include/imap/unix.h:206: error: syntax error before '*' token
/usr/include/imap/unix.h:207: error: syntax error before '*' token
/usr/include/imap/unix.h:209: error: syntax error before '*' token
/usr/include/imap/unix.h:210: error: syntax error before '*' token
/usr/include/imap/unix.h:211: error: syntax error before '*' token
/usr/include/imap/unix.h:212: error: syntax error before '*' token
/usr/include/imap/unix.h:213: error: syntax error before '*' token
/usr/include/imap/unix.h:214: error: syntax error before '*' token
/usr/include/imap/unix.h:215: error: syntax error before '*' token
/usr/include/imap/unix.h:216: error: syntax error before '*' token
/usr/include/imap/unix.h:219: error: syntax error before '*' token
/usr/include/imap/unix.h:221: error: syntax error before "DOTLOCK"
/usr/include/imap/unix.h:222: error: syntax error before "MAILSTREAM"
/usr/include/imap/unix.h:223: error: syntax error before '*' token
/usr/include/imap/unix.h:224: error: syntax error before '*' token
/usr/include/imap/unix.h:225: error: syntax error before '*' token
/usr/include/imap/unix.h:226: error: syntax error before '*' token
/usr/include/imap/unix.h:228: error: syntax error before '*' token
/usr/include/imap/unix.h:229: error: syntax error before '*' token
/usr/include/imap/unix.h:230: error: syntax error before '*' token
/usr/include/imap/unix.h:231: error: syntax error before '*' token
In file included from /devel/php-5.2.6/main/php.h:92,
from /devel/php-5.2.6/ext/libxml/libxml.c:28:
/usr/include/imap/unix.h:159: error: redefinition of `struct unix_local'
/usr/include/imap/unix.h:171: error: redefinition of typedef 'UNIXLOCAL'
/usr/include/imap/unix.h:171: error: previous declaration of 'UNIXLOCAL' was here
/usr/include/imap/unix.h:181: error: nested redefinition of `struct unix_file'
/usr/include/imap/unix.h:182: error: syntax error before "MAILSTREAM"
/usr/include/imap/unix.h:182: warning: no semicolon at end of struct or union
/usr/include/imap/unix.h:189: error: syntax error before '}' token
/usr/include/imap/unix.h:189: warning: data definition has no type or storage class
/usr/include/imap/unix.h:193: error: syntax error before '*' token
/usr/include/imap/unix.h:193: warning: data definition has no type or storage class
/usr/include/imap/unix.h:196: error: syntax error before '*' token
/usr/include/imap/unix.h:197: error: syntax error before '*' token
/usr/include/imap/unix.h:198: error: syntax error before '*' token
/usr/include/imap/unix.h:199: error: syntax error before '*' token
/usr/include/imap/unix.h:200: error: syntax error before '*' token
/usr/include/imap/unix.h:201: error: syntax error before '*' token
/usr/include/imap/unix.h:202: error: syntax error before '*' token
/usr/include/imap/unix.h:202: error: syntax error before '*' token
/usr/include/imap/unix.h:202: warning: data definition has no type or storage class
/usr/include/imap/unix.h:203: error: syntax error before '*' token
/usr/include/imap/unix.h:204: error: syntax error before '*' token
/usr/include/imap/unix.h:206: error: syntax error before '*' token
/usr/include/imap/unix.h:207: error: syntax error before '*' token
/usr/include/imap/unix.h:209: error: syntax error before '*' token
/usr/include/imap/unix.h:210: error: syntax error before '*' token
/usr/include/imap/unix.h:211: error: syntax error before '*' token
/usr/include/imap/unix.h:212: error: syntax error before '*' token
/usr/include/imap/unix.h:213: error: syntax error before '*' token
/usr/include/imap/unix.h:214: error: syntax error before '*' token
/usr/include/imap/unix.h:215: error: syntax error before '*' token
/usr/include/imap/unix.h:216: error: syntax error before '*' token
/usr/include/imap/unix.h:219: error: syntax error before '*' token
/usr/include/imap/unix.h:221: error: syntax error before "DOTLOCK"
/usr/include/imap/unix.h:222: error: syntax error before "MAILSTREAM"
/usr/include/imap/unix.h:223: error: syntax error before '*' token
/usr/include/imap/unix.h:224: error: syntax error before '*' token
/usr/include/imap/unix.h:225: error: syntax error before '*' token
/usr/include/imap/unix.h:226: error: syntax error before '*' token
/usr/include/imap/unix.h:228: error: syntax error before '*' token
/usr/include/imap/unix.h:229: error: syntax error before '*' token
/usr/include/imap/unix.h:230: error: syntax error before '*' token
/usr/include/imap/unix.h:231: error: syntax error before '*' token
make: *** [ext/libxml/libxml.lo] Error 1

Anyone ever seen anything like this?

Cheers.
Alex
 
Well, I've found a fix for my issue, here's what was done:

-- Compiling PHP 5.2.6 + IMAP 2004g on a 64 bit system --

1. Install Kerberos

x) cd into your sandbox directory
a) wget http://web.mit.edu/Kerberos/dist/krb5/1.5/krb5-1.5.4-signed.tar
b) unpack the archive
c) cd krb5-1.5.4/src
d) ./configure
e) make

*** do not 'make install'!!

2. Install IMAP 2004g

Step c may need to be adjusted depending on your OS, and the paths to your kerberos libs (created above)

x) cd into your sandbox directory
a) wget ftp://ftp.cac.washington.edu/imap/old/imap-2004g.tar.Z
b) tar -zxf imap-2004g.tar.Z
c) make lr5 EXTRACFLAGS=-I/devel/krb5-1.5.4/src/include/ EXTRALDFLAGS=-I/devel/krb5-1.5.4/src/lib/ EXTRAAUTHENTICATORS=gss

*** do not 'make install'!

d) create symlinks whilst still inside the imap directory:
ln -sf c-client lib
ln -sf c-client include

3. Build PHP

x) cd into your sandbox directory
a) get the PHP source (5.2.6 at time of this post)
b) unpack the php source
c) drum up your configure command, and specify --with-imap=/xxx/imap-2004g/ --with-imap-ssl --with-kerberos

That should do the trick! This was done on a CentOS 4.6 64-bit running DA. I think whatever the circumstances may be, building against the packages above would bypass any problems.

Good luck! This seems to be a hot topic!
 
This is how i have done it i tried all the options above but no luck i installed it on different kind of systems in the past and different kinds of php all need another way to handle it so try all the options

OS : Centos 5.2 64 bit (xen VM)

php : 5.2.6

Login as root
cd /usr/local/directadmin/customapache
wget http://files.directadmin.com/services/da_imap-2004g.tar.gz

tar -zxvf da_imap-2004g.tar.gz
cd imap-2004g
vi Makefile
Change
#EXTRACFLAGS= DA CHANGED
EXTRACFLAGS=-I/usr/kerberos/include -L/usr/kerberos/lib

To:

#EXTRACFLAGS= DA CHANGED
EXTRACFLAGS=-I/usr/kerberos/include -L/usr/kerberos/lib -fPIC

./buildit
cd c-client
mkdir /usr/local/imap-2004g/
mkdir /usr/local/imap-2004g/lib
mkdir /usr/local/imap-2004g/include
cp *.h /usr/local/imap-2004g/include
cp *.c /usr/local/imap-2004g/lib
cp c-client.a /usr/local/imap-2004g/lib
mv /usr/local/imap-2004g/lib/c-client.a /usr/local/imap-2004g/lib/libc-client.a

cd /usr/local/directadmin/customapache
vi configure.php

add
--with-imap=/usr/local/imap-2004g \
remove
--with-kerberos \

Save it
do a ./build clean
and a ./build php n

This worked for me
 
Hey there, I am trying to install PHP-imap too, I am new with this but why is there a need to remove the
--with-kerberos \

in the configure.php?
 
Back
Top