linux php 安裝GD庫


linux下為php添加GD庫的步驟如下: 


一、下載 

gd-2.0.33.tar.gz http://www.boutell.com/gd/ 
jpegsrc.v6b.tar.gz http://www.ijg.org/ 
libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/ 
zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/ 
freetype-2.1.9.tar.gz http://sourceforge.net/projects/freetype/ 
php-4.3.9.tar.gz http://www.php.net 


二、安裝 

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/里拷一個 

【出錯的話:collect2: ld returned 1 exit status

make: *** [pngtest] Error 1

可以直接編譯./configure –prefix=/usr/local/libpng】


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-4.3.9.tar.gz 
cd php-4.3.9 
./configure (以前的參數) --with-gd --enable-gd-native-ttf --with-zlib --with-png --with-jpeg --with-freetype --enable-sockets 
make 
make install 

<?php 
phpinfo(); 
?> 

Ok.....


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM