IMAP or Internet Message Access Protocol is a protocol for accessing email from an IMAP server for online/offline/disconnected operations. This protocol was developed 20 yrs ago at Stanford University. One of the current active implementation with rewritten c-library is maintained under the supervison of the University of Washington. The latest IMAP - although its name might not sound to imply - also support POP protocol. A few open source applications for email management like SquirrelMail and IMP rely on IMAP in conjunction with PHP.
Backgrounder on PHP:
PHP or (Phils Homepage Tools)PHP Hypertext Preprocessor is an Open Source scripting language mainly used for web applications (although it can be used for desktop applications through its CLI, an example of a GUI implementation of PHP is PHP-GTK. PHP is server side, which means the processing is loaded to the server. Over the years the PHP Platform has proven its effectiveness, although still under debate :) , even some Java-based servers attempts to fully implement PHP because of its proven robustness (ex. Resin). One of the popular applications that run PHP is Mambo. SugarCRM, IMP, SquirrelMail implements PHP in conjunction with IMAP
The Problem:
I have encountered some problems getting PHP to compile with IMAP. For some reason my Apache died on 1st compile attempt of PHP with IMAP which caused one of the livesites I administer to be down. I tried different combinations of PHP 4.4.1, PHP 5.1.6, PHP 5.2.0 on IMAP-2004g, IMAP-2006c, IMAP-DEVEL. It was one nightmare i had to venture on. In the hope of easing someone not to go the same route I did. The whole trial and error costed me straight 25 hrs.
I have installed the 3 different versions of IMAP in the same way as outlined:
- Uncompressed the gzipped source tarball
- Inititated make using "make gso" (was on a Solaris 9)
- Made 2 symlinks pointing to the c-client libraries directory as "lib" and "include"
- PHP 4.4.1 + imap-2006d.DEV.SNAP-0611062033
- PHP 5.1.6 + imap-2006d.DEV.SNAP-0611062033
- PHP 5.2.0 + imap-2006d.DEV.SNAP-0611062033
- PHP 4.4.1 + imap-2006c1
- PHP 5.1.6 + imap-2006c1
- PHP 4.4.1 + imap-2004g
- PHP 5.1.6 + imap-2004g
- PHP 5.2.0 + imap-2004g
- cd c-client - Changed directory to c-client inside the extracted IMAP
- edited MakeFile to include: BASECFLAGS="-fPIC -O3" specifically on the GSO line for Solaris
- mkdir shared - Made a temporary directory
- cd shared - Changed directory to the temporary directory
- ar xv ../c-client.a - Extracted the *.o files
- gcc -shared -o c-client.so *.o - Derive a shared c-client..so from the *.o files
- cp c-client.so /usr/local/imap/imap2006c1/c-client libclient.so -Thanks to Ben for the correction
- hide libc-client.a (by adding "." before the name")
- cd ..
- ln -sf c-client include
- ln -sf c-client lib
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --enable-mbstring --with-gd --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-zlib --with-curl --with-pgsql=/usr/local/pgsql --with-gettext --with-ncurses --with-imap=/usr/local/imap/imap-2006c1/ --with-imap-ssl=/usr/local/ssl/
3 comments:
My vServer stops "make" with the same error you had "php_imap.c:(.text+0x2260): undefined reference to `mail_expunge'".
Used your combination of php 5.2.0 and IMAP-2006c1.
I also have no /usr/local/imap/imap-2006c1/ location.
Using suse 9 and compiled c-client with "make slx". Is this maybe not correct?
c-client compiled as shareable like you mentioned in your post.
Could you help? Please?
Thanks for a great post.
One correction in your steps.
"cp c-client.so /usr/local/imap/imap2006c1/c-client as libclient.so"
This has a typo.
"cp /usr/local/imap/imap2006c1/c-client.so /usr/local/imap/imap2006c1/libc-client.so"
I am sure you were making some assumptions, but I had already tried like 500 other things before I came across your post.
Thanks Again!
@Ben, Yeah thanks.. i actually meant "copy c-client.so /usr/local/imap/imap2006c1/c-client as libclient.so", i kinda mixed up english with the command line, nice catch. Corrected. Thank you :)
Post a Comment