[转载~笔记]CentOS单独编译安装PHP gd库扩展

时间:2021-03-13 17:45:35

http://www.nowamagic.net/librarys/veda/detail/2610

 

 

 

安装gd前置库: freetype, jpegsrc, libpng

1. freetype
wget "http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2"
tar jxvf freetype-2.4.0.tar.bz2
cd freetype-2.4.0
./configure --prefix=/usr/local/freetype && make && make install

2. jpegsrc
wget "http://www.ijg.org/files/jpegsrc.v9.tar.gz"
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/jpeg && make && make install
mkdir -p /usr/local/jpeg/include
mkdir -p /usr/local/jpeg/lib
mkdir -p /usr/local/jpeg/bin
mkdir -p /usr/local/jpeg/man/man1

3. libpng
wget "http://down1.chinaunix.net/distfiles/libpng-1.2.10.tar.bz2"
tar jxvf libpng-1.2.10.tar.bz2
cd libpng-1.2.10
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libpng && make && make install

4. 编译gd
cd php-4.4.9
cd ext
cd gd

/usr/local/bin/phpize
./configure --with-php-config=/usr/local/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype --with-zlib-dir=/usr/lib

make && make install

5. 修改php.ini文件
在 ;extension=php_zip.dll 下面添加一行
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/gd.so