发布于 2014-11-17 14:38:13 | 1108 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的PHP设计模式,程序狗速度看过来!

PHP开源脚本语言

PHP(外文名: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,入门门槛较低,易于学习,使用广泛,主要适用于Web开发领域。PHP的文件后缀名为php。


本文为大家讲解的是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.



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务