configure 参数:
./configure
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--with-curl
--with-openssl
--with-config-file-path=/etc
--with-gd=/usr/local/lib/gd2
--with-jpeg-dir=/usr/local/lib/libjpeg
--with-png-dir=/usr/local/lib/libpng
--with-zlib=/usr/local/lib/zlib
--with-freetype-dir=/usr/local/lib/freetype
--with-sqlite
--with-pdo-sqllite
--with-mcrypt=/usr/local/lib/libmcrypt
--with-ttf
--enable-gd-native-ttf
--enable-mbstring
--with-gettext
以上无需换行
自5.3版本开始php已经支持原生mysql库 即mysqlnd,所以mysql只需要安装mysql-server即可
以下这些包是前置条件,没有就安装上去
gd-2.0.35.tar.gz
freetype-2.1.10.tar.gz
libpng-1.2.40.tar.gz
jpegsrc.v7.tar.gz
giflib-4.1.6.tar.bz2
libc-client-2004g-2.2.1.i386.rpm
libc-client-devel-2004g-2.2.1.i386.rpm
libmcrypt-2.5.7.tar.tar
libtool-2.2.6a.tar.gz
zlib-1.2.3.tar.tar
最后编译时出错
/usr/bin/ld: /usr/local/lib/zlib/lib/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/zlib/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1
参考来自于(http://hi.baidu.com/flyfreebsd/blog/item/5e234dbfca067e0218d81f68.html)的方法:
重新安装 zlib-1.2.3.tar.gz
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure
#vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
接下面步骤
#make
#make install