本文为大家讲解的是php下安装编译imap扩展的方法,感兴趣的同学参考下。 Internet Mail Access Protocol(缩写为IMAP,以前称作交互邮件访问协议(interactive mail access protocol))IMAP是斯坦福大学在1986年开发的一种邮件获取协议
本文为大家讲解的是php下安装编译imap扩展的方法,感兴趣的同学参考下。
Internet Mail Access Protocol(缩写为IMAP,以前称作交互邮件访问协议(interactive mail access protocol))IMAP是斯坦福大学在1986年开发的一种邮件获取协议。它的主要作用是邮件客户端(例如MS Outlook Express)可以通过这种协议从邮件服务器上获取邮件的信息,下载邮件等。当前的权威定义是RFC3501。IMAP协议运行在TCP/IP协议之上,使用的端口是143。它与POP3协议的主要区别是用户可以不用把所有的邮件全部下载,可以通过客户端直接对服务器上的邮件进行操作。
This shows you how to enable IMAP extension in PHP.
First, grab the latest c-client library from this website.
ftp://ftp.cac.washington.edu/imap/
In this example, I’m using imap-2007f.tar.gz.
Copy the source to a directory, e.g. /usr/local/
cp imap-2007f.tar.gz /usr/local/
cd /usr/local/
tar zxf imap-2007f.tar.gz
cd /usr/local/imap-2007f/
Open up the Makefile, find the port name for your system. I’m using RedHat Enterprise 5, so the port will be lr5. Once you have the port name, you can compile it.
You will have to 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.
cd /usr/local/imap-2007f/
make lr5
mkdir lib
mkdir include
cp c-client/*.c lib/
cp c-client/*.h include/
cp c-client/c-client.a lib/libc-client.a
So, now, you are done with the compiling of c-client library. You have to compile PHP to enable IMAP support.
I’m using PHP 5.3.3 and the source is in /usr/local/src/php-5.3.3/
If you have compiled PHP before, you have to remove “config.cache” and “make clean”, otherwise skip this step and go to the next.
cd /usr/local/src/php-5.3.3/
rm config.cache
make clean
To compile PHP with IMAP ( + SSL ) Support, modify the configure command to include –with-imap=/usr/local/imap-2007f and –with-imap-ssl
cd /usr/local/src/php-5.3.3/
./configure … --with-imap=/usr/local/imap-2007f --with-imap-ssl
Next, make and make install
make
make install
If you encounter the following similar error during make, read on, otherwise stop and start your Apache server and you are good to go.
can not be used when making a shared object; recompile with –fPIC
/usr/local/imap-2007f/lib/libc-client.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1
To fix the above error, you would have to re-compile the IMAP c-client library with -fPIC and re-compile PHP again.
cd /usr/local/imap-2007f/
make lr5 EXTRACFLAGS=-fPIC
mkdir lib
mkdir include
cp c-client/*.c lib/
cp c-client/*.h include/
cp c-client/c-client.a lib/libc-client.a
That’s all. Have fun!. If you have any questions, please post in the comment.
声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!