标题:Linux编译php支持gd库和png jpeg扩展 出处:沧海一粟 时间:Fri, 10 Apr 2009 16:36:32 +0000 作者:jed 地址:http://www.dzhope.com/post/582/ 内容: 要支持扩展,编译了好几次,也许是版本匹配的问题, 最后终于编译成功了: 把关键部分写一下: mkdir /usr/local/modules —————————————————————— 开始编译: tar -zxf zlib-1.2.3.tar.tar ls cd zlib cd zlib-1.2.3 ./configure --prefix=/usr/local/zlib make make install cd .. ———————————————————— tar zxvf freetype-2.3.7.tar.gz cd freetype-2.3.7 ls ./configure --prefix=/usr/local/modules/freetype make make install freetype编译完毕 —————————————————————— wget http://prdownloads.sourceforge.net/png-mng/libpng-1.2.5.tar.gz?download tar zxvf libpng-1.2.5.tar.gz cd libpng-1.2.5 ls cp scripts/makefile.linux makefile cp scripts/makefile.linux makefile make test make install —————————————————— cd .. wget ftp://ftp.ro.debian.org/pub/mirrors/openwrt.org/sources/jpegsrc.v6b.tar.gz tar -xzvf jpegsrc.v6b.tar.gz ls cd jpeg-6b/ mkdir /usr/local/modules/jpeg6 mkdir /usr/local/modules/jpeg6/bin mkdir /usr/local/modules/jpeg6/lib mkdir /usr/local/modules/jpeg6/include mkdir /usr/local/modules/jpeg6/man mkdir /usr/local/modules/jpeg6/man/man1 ./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static make make install ———————————————————— cd .. tar -xzvf gd-2.0.35.tar.gz cd gd-2.0.35 ls ./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype make make install cd .. —————————————————— 开始编译php: tar -xzvf php-5.2.6.tar.gz cd php-5.2.6 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-freetype-dir=/usr/local/modules/freetype/ --with-mysql=/usr/local/mysql --with-zlib --with-libxml-dir=/usr/local/libxml --enable-shared --with-gd=/usr/local/modules/gd/ --with-jpeg-dir=/usr/local/modules/jpeg6/ --with-png-dir --enable-mbstring=all --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-gd-native-ttf make make test make install ——————————————————— 编译完毕。 重启apache服务。 注:在编译的过程中,如果发现错误,什么目录没有,就mkdir建立。之后再编译。 看phpinfo是否支持你想要的模块,若没有再编译即可。 Generated by Bo-blog 2.1.1 Release