IMAP PHP extension module

migmac

Verified User
Joined
Apr 15, 2014
Messages
88
Hello,

I have spent hours trying to install IMAP PHP extension module, I think I tried all the existing topics about this and it doesn't work

I am using Centos 64 bits with directadmin, the error is

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

The installations instructions I tried to use where: http://www.directadmin.com/imap.txt

locate libc-client.a
/usr/local/imap-2007f/lib/libc-client.a

in configure.php5 now I have at the end of the file

--with-imap-ssl=/usr/local/imap-2007f \
--with-imap=/usr/local/imap-2007f

it's been hard, I spent several hours trying to fix just this, I do appreciate any help

thank you
 
I am using smtalk bash script in reply #4, and it works http://forum.directadmin.com/showthread.php?t=45434&p=232384#post232384 (but remember to change version in his script to be the newest 2007f).

The installation instructions at directadmin.com/imap.txt is old and outdated and should not be used.

Hi,
can you tell me what needs to be changed in the script to the new version of 2007f please?

is it on the script itself or at the configure.php* ?

--with-imap=/usr/local/php-imap \
--with-imap-ssl \

should be replaced by

--with-imap-ssl=/usr/local/imap-2007f \
--with-imap=/usr/local/imap-2007f

thank you
 
It would help a lot more to see what errors specifically you are having. It might be as simple as updating the config file or it might involve installing a dependent package, but it is hard to say without seeing the errors.
 
It would help a lot more to see what errors specifically you are having. It might be as simple as updating the config file or it might involve installing a dependent package, but it is hard to say without seeing the errors.

if I run the directadmin admin instructions I get the error

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

if I run the script suggested by ditto, I get

Invalid command 'php_admin_flag',

now I am tried to run what scsi suggested at the topic http://forum.directadmin.com/showthread.php?t=32606

cd /usr/local/directadmin/custombuild
./build update
./build clean
./build php d
./build suphp d

the apache is now broken so I run what cacthanh123 suggested on same topic:

./build all d
./build rewrite_confs
 
if I run the directadmin admin instructions I get the error

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

if I run the script suggested by ditto, I get

Invalid command 'php_admin_flag',

now I am tried to run what scsi suggested at the topic http://forum.directadmin.com/showthread.php?t=32606

cd /usr/local/directadmin/custombuild
./build update
./build clean
./build php d
./build suphp d

the apache is now broken so I run what cacthanh123 suggested on same topic:

./build all d
./build rewrite_confs

and it ended with this error:
Check './configure --help' for available options

/usr/local/directadmin/custombuild/custom/ap2/configure.php5: line 37: --with-imap-ssl=/usr/local/imap-2007f: No such file or director y

*** There was an error while trying to configure php. Check the custom/ap2/configure.php5 file
 
The invalid php_admin_flag is due to php not being compiled/linked correctly. I am guessing that is due to php build not being able to find the libc-client.a file. Did you go through the rest of http://www.directadmin.com/imap.txt where it tells you to make the links? You may need to look in the php config.log file to see where it was actually searching for the libc-clent.a and why it didn't find it.
 
Try using only:
--with-imap-ssl
Don't include the directory path just this option in addition to the other option to enable imap support. I think it is failing to find the ssl library.
 
and it ended with this error:
Check './configure --help' for available options

/usr/local/directadmin/custombuild/custom/ap2/configure.php5: line 37: --with-imap-ssl=/usr/local/imap-2007f: No such file or director y

*** There was an error while trying to configure php. Check the custom/ap2/configure.php5 file


ditto,

maybe this is what needs to be changed in the script?

VERSION=2006k
URL="ftp://ftp.cac.washington.edu/imap/old/imap-${VERSION}.tar.Z"
FILENAME=imap-${VERSION}
TARBALL=${FILENAME}.tar.Z

should it be something like

VERSION=2006k
URL="ftp://ftp.cac.washington.edu/imap/imap-${VERSION}.tar.Z"
FILENAME=imap-${VERSION}
TARBALL=${FILENAME}.tar.Z

just remove the folder old?

thank you
 
can you tell me what needs to be changed in the script to the new version of 2007f please?

You should to change line number 23 and 24 in smtalk's bash script, those two lines should be changed to look like this:

Code:
VERSION=2007f
URL="ftp://ftp.cac.washington.edu/imap/imap-${VERSION}.tar.Z"

Here is a complete copy of smtalk's bash scripts with those changes already applied:

Code:
# !/bin/sh
# Script for PHP-IMAP installation. 0.1b
# Written by Martynas Bendorius (smtalk)

CWD=`pwd`
OS=`uname`

# Is it a 64-bit OS?
B64=0
    
B64COUNT=`uname -m | grep -c 64`
if [ "$B64COUNT" -eq 1 ]; then
    B64=1
    LD_LIBRARY_PATH=/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
    export LD_LIBRARY_PATH
fi

if [ ! -e /usr/include/krb5.h ] && [ -e /etc/redhat-release ]; then
    echo "Installing krb5-devel"
    yum -y install krb5-devel
fi

VERSION=2007f
URL="ftp://ftp.cac.washington.edu/imap/imap-${VERSION}.tar.Z"
FILENAME=imap-${VERSION}
TARBALL=${FILENAME}.tar.Z

echo "Downloading ${TARBALL}..."
wget -O ${TARBALL} ${URL}
tar xzf ${TARBALL}
cd ${FILENAME}

echo "Installing ${FILENAME}..."

if [ ${OS} = "FreeBSD" ]; then
    if [ ${B64} -eq 0 ]; then
        make bsf
    else
        make bsf EXTRACFLAGS=-fPIC
    fi
else
    perl -pi -e 's#SSLDIR=/usr/local/ssl#SSLDIR=/etc/pki/tls#' src/osdep/unix/Makefile
    perl -pi -e 's#SSLINCLUDE=\$\(SSLDIR\)/include#SSLINCLUDE=/usr/include/openssl#' src/osdep/unix/Makefile
    perl -pi -e 's#SSLLIB=\$\(SSLDIR\)/lib#SSLLIB=/usr/lib/openssl#' src/osdep/unix/Makefile
    if [ ${B64} -eq 0 ]; then
        make slx
    else
        make slx EXTRACFLAGS=-fPIC
    fi
fi

echo "Copying files to /usr/local/php-imap"
mkdir -p /usr/local/php-imap/include
mkdir -p /usr/local/php-imap/lib
chmod -R 077 /usr/local/php-imap
cp -f c-client/*.h /usr/local/php-imap/include/
cp -f c-client/*.c /usr/local/php-imap/lib/
cp -f c-client/c-client.a /usr/local/php-imap/lib/libc-client.a
cd ..
rm -rf ${FILENAME}

exit 0;

is it on the script itself or at the configure.php* ?

--with-imap=/usr/local/php-imap \
--with-imap-ssl \

should be replaced by

--with-imap-ssl=/usr/local/imap-2007f \
--with-imap=/usr/local/imap-2007f

thank you

You should add/replace with these two new lines in /usr/local/directadmin/custombuild/custom/ap2/configure.php54 (if you run php 5.4, choose configure.php55 or configure.php53 if you run php 5.5 or 5.3):

Code:
--with-imap=/usr/local/php-imap \
--with-imap-ssl \

Important: The last line in configure.php54 should not have a ending \, so if you add the above to the bottom of the file, you need to remove \ after --with-imap-ssl and then need to add \ at the end of the line that used to be the last line. It might be more easy if you just add the two lines before the existing last line, then you don't have to think about that.

Then you just run the bash script, and after that you recompile php like this:

Code:
cd /usr/local/directadmin/custombuild
./build update
./build php n
 
Last edited:
Hi,

sorry, but I had to activate suphp. so what I did was:

cd /usr/local/directadmin/custombuild/
./build clean
./build update
./build set php5_cgi yes
./build set php5_cli no
./build all d
./build rewrite_confs

and IMAP PHP is not working again, what did I made wrong?

Thank you!
 
"If you're using suphp, the paths would be configure/suphp/configure.php5 and custom/suphp/configure.php5." http://help.directadmin.com/item.php?id=252

So you need to copy configure.php54 (copy the one that is your php version) from this path /usr/local/directadmin/custombuild/configure/suphp/ then you create custom/suphp/ folders and add the configure file to this path: custombuild/custom/suphp/configure.php54 (this file would be wrong if you run a different php version, use the correct configure file for your php version).

Then you re-add the two lines:
Code:
--with-imap=/usr/local/php-imap \
--with-imap-ssl \

Remember that the last line should not contain \, but all other lines should have the ending \

Then you recompile php:
Code:
./build update
./build php n
 
Last edited:
Hi,

wow, it's complicated, can you please check if this is what you mean?


cd /usr/local/directadmin/custombuild
mkdir -p custom/suphp
cp -fp configure/suphp/configure.php5 custom/suphp/configure.php5

edit custom/suphp/configure.php5 and add the lines:
--with-imap=/usr/local/php-imap \
--with-imap-ssl \

./build update
./build php n

thank you
 
The file name in your example is wrong, it should be the same as your php version. I do not know what your php version is.

You shall do the same as before, it's only that suphp uses it's own configure file on it's own path, so you must create it. I don't know you php version, so I can't post the file name.

1: Just download/copy this file that has your php version in its file name from here:
/usr/local/directadmin/custombuild/configure/suphp

2: Then you create this folder:
/usr/local/directadmin/custombuild/custom/suphp/

3: Then you upload the file from step 1 to this path:
/usr/local/directadmin/custombuild/custom/suphp/

4: Then you edit the file you uploaded in step 3 and add this:

Code:
--with-imap=/usr/local/php-imap \
--with-imap-ssl \

Remember to remove \ from the last line, and add the \ to the previous last line.

5: Then you recompile php:

Code:
./build update
./build php n

It is not complicated.
 
Hi,

it did work,

[root@server1 suphp]# php -v
PHP 5.3.28 (cli) (built: Apr 17 2014 01:40:33)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
[root@server1 suphp]#

PHP is version 5.3 and I only have those files:

[root@server1 suphp]# pwd
/usr/local/directadmin/custombuild/configure/suphp
[root@server1 suphp]# ls
configure.php5 configure.php6 configure.suphp
[root@server1 suphp]#


but it's now ok, now I have another error, maybe caused by suphp, it is:

"It is also possible that your server's version of PHP does not have SSL support. You may need to ask your host to recompile their version of PHP with SSL support or to install a PHP SSL package.
"

do you know if this is also a module missing on the new config file at custom/suphp?

thank you
 
I don't use suphp, so I can't help anymore. Hopefully someone else can help you. I only use mod_php + mod_ruid2
 
Back
Top