1、安装GD库
安装freeytpe
# tar zxvf freetype-2.4.3.tar.gz -C /usr/local/src/freetype-2.4.3
# cd /usr/local/src/freetype-2.4.3
# ./configure --prefix=/usr/local/freetype-2.4.3
# make
# make install
安装libpng
#tar -zxvf libpng-1.4.4.tar.gz -C /usr/local/src/
# cd /usr/local/src/libpng-1.4.4
#./configure --prefix=/usr/local/libpng-1.4.4
# make
# make install
安装jpeg
# tar -zxvf jpegsrc.v8b.tar.gz -C /usr/local/src/
# cd /usr/local/src/jpeg-8b/
# ./configure --prefix=/usr/local/jpeg-8b
# make
# make install
# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
注:在RHEL5系统64 位下编译jpeg-6b时候报以下错误
make: ./libtool: Command not found make: *** [jcapimin.lo] Error 127
错误分析:由于libtool版本过低导致的,进入jpeg-6b的源码目录,复制相关文件覆盖,然后重新configure。
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
安装GD
最好重新加载下lib #ldcongfig
查询下 #ldcongfig -p | grep jpeg
#ldcongfig -p | grep free
#ldcongfig -p | grep libpng
# tar zxvf gd-2.0.35.tar.gz -C /usr/local/src
# cd /usr/local/src/gd-2.0.35
# ./configure --prefix=/usr/local/gd-2.0.33 --with-jpeg=/usr/local/jpeg-8b --with-freetype=/usr/local/freetype-2.4.3 --with-png=/usr/local/libpng-1.4.4/ --with-zlib --enable-m4_pattern_allow
#make && make install
make[2]: *** [gd_png.lo] 错误 1
找到“png.h”改成“/usr/local/libpng-1.4.4/include/png.h”
问题1:
编译最新的2.0.35版本,make的时候出现以下错误:
configure.ac:64: error: possibly undefined macro: AM_ICONV
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
make: *** [configure] Error 1
解决办法: configure的时候加上--enable-m4_pattern_allow参数;便能顺利编译安装
问题2:
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
解决:没有安装gettext软件包
gettext-0.14.6-4.el5、gettext-devel-0.14.6-4.el5
2、安装其他组件
安装 libiconv
#iconv的功能可算强大,可以对文本进行编码间的转换,它支持世界上很多的语言,当然我们主要用它来处理中文各种编码之间的转换,libiconv是一个开源的开发包,使用它可以非常方便的开发出适合自己用的编码转换工具。在这里http://gnuwin32.sourceforge.net/packages/libiconv.htm可以下载到libiconv的文档和开发包。
iconv本身linux系统自带,检查是否有/usr/bin/iconv 及 /usr/include/iconv.h 文件
安装 libmcrypt
#phpmyadmin基本上都安装完成了之后,出现了一个错误信息无法载入mcrypt 扩展
#Mcrypt扩展库依赖的包
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8/
# ./configure
# make && make install
# /sbin/ldconfig
# cd libltdl/
# ./configure --enable-ltdl-install
# make && make install
安装mhash
#Mcrypt扩展库依赖的包
# tar zxvf mhash-0.9.9.9.tar.gz
# cd mhash-0.9.9.9/
# ./configure
# make
# make install
安装mcrypt
#其中,Mcrypt扩展库可以实现加密解密功能,就是既能将明文加密,也可以密文还原。PHP加密扩展库Mcrypt的算法和加密模式
# tar zxvf mcrypt-2.6.8.tar.gz
# cd mcrypt-2.6.8
# LD_LIBRARY_PATH=/usr/local/lib ./configure --with-libiconv-prefix
# make
# make install
注:configure时候出现如下错误:
configure: error: "You need at least libmhash 0.8.15 to compile this program http://mhash.sf.net/"
前面已经安装过mhash,初步分析为预编译的时候没找到lib文件所在的地址;
所以在./configure前面加上LD_LIBRARY_PATH=/usr/local/lib
安装 libevent
# tar -xzvf libevent-1.4.9-stable.tar.gz
# cd /usr/local/libevent-1.4.9-stable/
# ./configure --prefix=/usr/local/libevent
# make
# make install
#libevent是一个事件触发的网络库,适用于windows、linux、bsd等多种平台,内部使用select、epoll、kqueue等系统调用管理事件机制。著名分布式缓存软件memcached也是libevent based,,编译库代码,编译脚本会判断OS支持哪种类型的事件机制(select、epoll或kqueue),然后条件编译相应代码,供上层使用的接口仍然是保持统一的
安装pcre
#PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正规表达式库.这些在执行正规表达式模式匹配时用与Perl 5同样的语法和语义是很有用的。Boost太庞大了,使用boost regex后,程序的编译速度明显变慢。测试了一下,同样一个程序,使用boost::regex编译时需要3秒,而使用pcre不到1秒。因此改用pcre来解决C语言中使用正则表达式的问题
# tar zxvf pcre-7.9.tar.gz
# cd pcre-7.9/
# ./configure
# make && make install
--prefix=/usr/local/php-5.2.10 --with-mysql=/usr/local/mysql/ --with-freetype-dir=/usr/local/freetype-2.4.3 --with-jpeg-dir=/usr/local/jpeg-8b --with-png-dir=/usr/local/libpng-1.4.4/ --with-zlib --with-libxml-dir --enable-xml --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring //
--with-gd=/usr/local/gd-2.0.33 --with-openssl
# make && make install
配置php-cgi
# vi /usr/local/php-5.2.10/etc/php-fpm.conf
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
500
//修改php进程的最大数为500进程
Unix user of processes
www
Unix group of processes
www
//守护进程的用户
启动php-cgi
# echo “ulimit -SHn 65535” >> /etc/rc.loal
# /usr/local/php-5.2.10/sbin/php-fpm start
注:php-cgi进程,监听127.0.0.1的9000端口,进程数为500
(如果服务器内存小于3GB,可以只开启64个进程),用户为www(上面的配置)
php-fpm还有其他参数,包括:start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重新加载配置文件使用reload
server
{
listen 80;
server_name status.206.xywy.com;
location / {
stub_status on;
access_log off;
}
}
启动nginx
# /usr/local/ nginx-0.7.65/sbin/nginx
当修改了nginx.conf配置,想测试一下是否正确,可以用下面的命令
# /usr/local/ nginx-0.7.65/sbin/nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful