今天又进行了次pnp的安装,发现php无法支持gd等库,解决过程如下:

###安装jpeg,以下几个目录需要创建,当编译完成后,并不会自动创建,当然包括libjpeg.so也不会存在

mkdir -p /usr/local/jpeg6/bin

mkdir -p /usr/local/jpeg6/lib

mkdir -p /usr/local/jpeg6/include

mkdir -p /usr/local/jpeg6/man/man1
tar -zxvf libtool-1.5.22.tar.gz
cd libtool-1.5.22 &&./configure && make && make install
然后进入jpeg的源码目录,一定要执行
# cp /usr/local/share/libtool/config.sub ./
# cp /usr/local/share/libtool/config.guess ./
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static 
# make 
# make install
 
##安装libpng
tar -jxvf libpng-1.2.40.tar.bz2
cp scripts/makefile.gcmmx makefile
./configure --prefix=/usr/local/libpng && make && make install
(libpnp生成的安装目录并不是libpng,而是lib)
 
tar -zxvf gd-2.0.33.tar.gz 
./configure --prefix=/usr/local/gd --with-png=/usr/local/lib --with-jpeg=/usr/local/jpeg6/
make && make install 
cp gd.h /usr/local/lib  --这一步很重要,不然后面会报错  
  
ldconfig -v   更新库
 
php-5.3.5.tar.gz
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/lib --enable-sockets --with-gd --with-zlib
--此处的with-gd后面不能加gd的安装目录,否则会报错
编译安装php时出错configure: error: build test failed.
 
参考文章:
http://www.oschina.net/question/17_87
http://blog.yntv.cn/html/28/28-360.html