PHP + IMAP on 64Bit machines

FransVanNispen

Verified User
Joined
Oct 14, 2005
Messages
21
Given the time I have spend solving this problem and all posts I have seen from people with similar problems, still unsolved, I figured a small post on this here might be appreciated.

The two typical errors:

1. configure: error: Cannot find imap library (libc-client.a). Please check your IMAP installation.

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

The problem seems to be caused by mixture of 32bit and 64bit static code, with which the linker has trouble relocating.

So, how can you fix this? Use PIC-code:

1. Make sure kereberos is installed: yum install krb5 krb5-devel

2. Install the libc-client. This must be the one from DA, as it contains small modifications for virtual accounts (as I read on this forum).

Code:
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

Modify the Makefile for the libc-client to use PIC-code:

Find these lines:

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

And change them to (only added option -fPIC):

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


Code:
./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

3. Modify the configure.php (or configure.php_ap2 for Apache2) file:

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

Remove option: --with-kerberos

Add options:
--enable-pic \
--with-libdir=lib64 \
--with-imap=/usr/local/imap-2000e


4. Compile PHP:

./build clean
./build php_ap2 n (for Apache2, for Apache1 use: ./build php n)


Now you should end up with a working PHP+IMAP. Just need to restart Apache to load the new version:

/sbin/service httpd restart (or restart from DA)
 
Frans, with this info i succeeded with PHP 4.4.7, but now upgrading to php 5.2.4 following the instructions on DA i get:

configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
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-freetype \
--with-freetype-dir=/usr/local/lib \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
--with-mcrypt \
--with-mhash \
--with-mysql=/usr \
--with-pear \
--with-png-dir=/usr/local/lib \
--with-xml \
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--with-zip \
--with-openssl \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-track-vars \
--enable-mbstring \
--enable-memory-limit \
--enable-pic \
--with-libdir=lib64 \
--with-imap=/usr/local/imap-2004g
Any suggestion for me ?

Regards,
Cees.
 
Hi Cees,

It means that you either didn't do step 2, or something went wrong in that step as it is the basic fault to start with.
 
An alternative to this on CentOS 64, is to simply:

# yum install libc-client-devel.x86_64
# ln -s /usr/lib64/libc-client.a /usr/lib/libc-client.a

Adding --with-imap should now no longer throw libc-client.a errors.
 
I tried the options here but still receive errors.

Code:
-lm -lcrypt -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lcrypt  -o sapi/cli/php
/usr/local/imap-2004g/lib/libc-client.a(osdep.o)(.text+0x9caa): In function `ssl_onceonlyinit':
/usr/local/directadmin/customapache/imap-2004g/c-client/osdep.c:268: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
ext/openssl/.libs/openssl.o(.text+0x73f4): In function `zif_openssl_seal':
/usr/local/directadmin/custombuild/php-5.2.6/ext/openssl/openssl.c:3633: undefined reference to `EVP_CIPHER_CTX_block_size'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

Any ideas?
 
THE BETTER WAY FOR install it on centos5.x 64 bits :

# yum install libc-client-devel.x86_64
# ln -s /usr/lib64/libc-client.a /usr/lib/libc-client.a

make clean your install php and compile php with these options in your configure options of php

--with-imap=/usr/lib64/
--with-imap-ssl

if you have an error
# yum install pam-devel
and retry
 
Back
Top