linux環境下php GD庫的安裝

1.安裝zlib

tar zxvf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure
make
make install

2.安裝libpng

tar zxvf libpng-1.2.7.tar.tar
cd libpng-1.2.7
cd scripts/
mv makefile.linux ../makefile
cd ..
make
make install
注意,這里的makefile不是用./configure生成,而是直接從scripts/里拷一個

3.安裝freetype

tar zxvf freetype-2.1.9.tar.gz
cd freetype-2.1.9
./configure
make
make install

4.安裝Jpeg

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure –enable-shared
make
make test
make install
注意,這里configure一定要帶–enable-shared參數,不然,不會生成共享庫

5.安裝GD

tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure –with-png –with-freetype –with-jpeg
make install

6.重新編譯PHP

tar zxvf php-5.2.17tar.gz
cd php-5.2.17
./configure (以前的參數) –with-gd –enable-gd-native-ttf –with-zlib –with-png –with-

jpeg –with-freetype –enable-sockets
make
make install
./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-

apxs2=/usr/local/apache2/bin/apxs –with-gd –enable-gd-native-ttf –with-zlib –with-png

–with-jpeg –with-freetype –enable-sockets
<?php
phpinfo();
?>

Ok…..??rhel5.3我的個人配置然后編輯php.ini,加入extension=gd.so
重啟apache就行了

買云主機,就上YUNVM!