🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 安装 安装 gd 库需要的库 ``` yum -y install libpng libpng-devel libjpeg libjpeg-devel m4 autoconf ``` ### 安装freetype ``` wget https://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 ``` ### 安装jpegsrc ``` https://www.ijg.org/files/jpegsrc.v9.tar.gz tar zxvf jpegsrc.v9.tar.gz cd jpeg-9 ./configure --prefix=/usr/local/jpeg && make && make install ``` ### 安装zlib ``` https://www.zlib.net/fossils/zlib-1.2.8.tar.gz tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure --prefix=/usr/local/zlib make && make install ``` ### 安装libpng ``` https://src.fedoraproject.org/lookaside/pkgs/libpng/libpng-1.6.16.tar.gz/1a4ad377919ab15b54f6cb6a3ae2622d/libpng-1.6.16.tar.gz tar -zxvf libpng-1.6.16.tar.gz cd libpng-1.6.16 ./configure --prefix=/usr/local/libpng make && make install ``` ### 安装 libXpm ``` https://www.x.org/releases/individual/lib/libXpm-3.5.5.tar.gz tar -zxvf libXpm-3.5.5.tar.gz cd libXpm-3.5.5 ./configure --prefix=/usr/local/libXpm make && make install ``` ### 安装 libvpx ``` https://github.com/webmproject/libvpx/archive/v1.9.0.tar.gz tar -zxvf v1.9.0.tar.gz cd v1.9.0 ./configure --prefix=/usr/local/libvpx make && make install ``` ## 编译 ``` > cd /usr/local/php-5.6.31/ext/gd > /usr/local/php/bin/phpize > ./configure --with-php-config=/usr/local/php/bin/php-config \ --with-jpeg-dir=/usr/local/jpeg \ --with-png-dir=/usr/local/libpng \ --with-freetype-dir=/usr/local/freetype \ --with-vpx-dir=/usr/local/libvpx \ --with-xpm-dir=/usr/local/libXpm \ --with-zlib-dir=/usr/local ``` > 如果编译出现问题, 查看 gd 目录下的 config.log 查看错误信息