现在的位置: 首页 > 综合 > 正文

CentOS下安装php的GD库

2018年04月30日 ⁄ 综合 ⁄ 共 1511字 ⁄ 字号 评论关闭

一、需要下载的软件包

   gd库相关包(http://www.libpng.org/pub/png/libpng.html



   gd-2.0.35.tar.gz

   jpegsrc.v7.tar.gz

   libpng-1.2.39.tar.gz

   zlib-1.2.3.tar.gz

   freetype-2.3.9.tar.gz

 

二、安装php的GD库

1.安装zlib

 



>tar -zxvf zlib-1.2.3.tar.gz

>cd zlib-1.2.3

>./configure --prefix=/usr/local/zlib

>make

>make install

 



2.安装libpng

 



>tar -zxvf libpng-1.2.39.tar.gz

>cd libpng-1.2.39

>cd scripts/



>mv makefile.linux ../makefile    //注意,这里的makefile不是用./configure生成,而是直接从scripts/里拷一个



>cd ..

>make

>make install

 



3.安装freetype

 



>tar -zxvf freetype-2.3.9.tar.gz

>cd freetype-2.3.9

>./configure --prefix=/usr/local/freetype

>make

>make install

 



4.安装Jpeg

 



>tar -zxvf jpegsrc.v7.tar.gz

>cd jpeg-7

>./configure --prefix=/usr/local/jpeg --enable-shared  //这里configure一定要带--enable-shared参数,不然,不会生成共享库

>make



>make test

>make install

 



5.安装GD

 



>tar -zxvf gd-2.0.35.tar.gz

>cd gd-2.0.35

>./configure --prefix=/usr/local/gd --with-png --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg

>make

>make install

 

6.重新编译PHP

 



>cd php-5.3.0

>./configure (以前的参数) --with-gd=/usr/local/gd --enable-gd-native-ttf --with-zlib=/usr/local/zlib --with-png
--with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --enable-sockets

>make

>make install

 

三、常见问题及解决

   1、现象:安装gd时,make
install提示如下问题:

            warning:
macro `AM_ICONV' not found in library

      解决:yum
-y install gettext

   2、现象:安装freetype时,configure的时候显示如下

            config.status:
executing libtool commands

            make:
Nothing to be done for `unix'.

      解决:make
clean 然后再 make   make
install(此方法我在freetype2.3.5---2.3.9均试过,不能成功,还没有找到成功的解决方法)

出处:http://blog.163.com/yuang_yu_ping

分类: nginx

抱歉!评论已关闭.