编译安装php 5.3.8所需的支持库
-
libiconv(加强系统对支持字符编码转换的功能)
#下载url wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz; tar zxvf libiconv-1.14.tar.gz; cd libiconv-1.14/; ./configure --prefix=/usr/local; make && make install; #命令汇总: wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz;tar zxvf libiconv-1.14.tar.gz;cd libiconv-1.14/;./configure --prefix=/usr/local;make && make install;cd ../
如果你的glibc版本在2.16以上,make时很有可能出现如下错误
In file included from progname.c:26:0: ./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function) _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ^
参考这里的方法,下载patch文件,解压后打上patch即可。
在libiconv-1.14目录下执行
yum -y install patch gzip; wget -O - http://blog.atime.me/static/resource/libiconv-glibc-2.16.patch.gz | gzip -d - | patch -p0
-
libmcrypt(加密算法库,php扩展mcrypt功能对此库有依耐关系,要使用mcrypt必须先安装此库)
#下载url wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz 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; #命令汇总: 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;cd ../../
#编译安装libltdl时可能会遇到的错误: /bin/sh ./libtool --mode=compile gcc -dhave_config_h -i. -i. -i. -g -o2 -c ltdl.c mkdir .libs gcc -dhave_config_h -i. -i. -i. -g -o2 -c ltdl.c -fpic -o .libs/ltdl.o gcc -dhave_config_h -i. -i. -i. -g -o2 -c ltdl.c -o ltdl.o >/dev/null 2>&1 /bin/sh ./libtool --mode=link gcc -g -o2 -o libltdl.la -rpath /usr/local/lib -no-undefined -version-info 4:0:1 ltdl.lo -ldl ./libtool: line 3965: elf [0-9][0-9]*-bit [lm]sb (shared object | dynamic lib ): command not found ./libtool: line 3965: elf [0-9][0-9]*-bit [lm]sb (shared object | dynamic lib ): command not found ./libtool: line 3965: elf [0-9][0-9]*-bit [lm]sb (shared object | dynamic lib ): command not found ./libtool: line 3965: elf [0-9][0-9]*-bit [lm]sb (shared object | dynamic lib ): command not found #产生原因:源码包中libtool版本过低。 解决方法:让编译时调用系统的libtool。修改makefile文件,libtool=$(shell)$(top_builddir)/libtool为libtool=$(shell) /usr/bin/libtool
-
mhash(hash加密算法库) mcrypt功能对此库有依耐关系
#下载url wget http://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz tar zxvf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure make && make install; #命令汇总: tar zxvf mhash-0.9.9.9.tar.gz;cd mhash-0.9.9.9;./configure;make;make install;cd ../
-
建立libmcrypt相关库的软连接,为编译mcrypt作准备。因为mcrypt依赖libmcrypt
建立libmhash相关库的软连接,为编译mcrypt作准备。mcrypt也依赖libmhash#64位 ln -sf /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la ln -sf /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so ln -sf /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 ln -sf /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 ln -sf /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -sf /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2 ln -sf /usr/local/lib/libmhash.a /usr/lib64/libmhash.a ln -sf /usr/local/lib/libmhash.la /usr/lib64/libmhash.la ln -sf /usr/local/lib/libmhash.so /usr/lib64/libmhash.so ln -sf /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 ln -sf /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ldconfig #32位 ln -sf /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -sf /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -sf /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -sf /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -sf /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ln -sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 ln -sf /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -sf /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -sf /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -sf /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -sf /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ldconfig
-
mcrypt编译
#下载url wget http://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz tar zxvf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ /sbin/ldconfig ./configure make && make install; #命令汇总: tar zxvf mcrypt-2.6.8.tar.gz;cd mcrypt-2.6.8/;/sbin/ldconfig;./configure;make && make install;cd ../
./configure时可能会报这个错:/bin/rm: cannot remove `libtoolt’: no such file or directory。 解决方法:修改configure文件,删除$rm “$cfgfile”这一行(在19744行)。重新再运行./configure就可以了。 看了下configure文件,其实可以忽略这个错。configure文件中cfgfile=”${ofile}t”定义的这里变量值是不存在的(${ofile}t的值为libtoolt),最后所以报错了。