第一步 安装依赖
1、安装xpm
yum install libXpm-devel
2、安装zlib
wget http://www.zlib.net/fossils/zlib-1.2.8.tar.gz tar -xzvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure make && make install make clean && make distclean cd ../
3、安装libjpeg jpeg-9b
wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz tar -xzvf jpegsrc.v9b.tar.gz cd jpeg-9 ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static make && make instll make clean && make distclean libtool --finish /usr/local/jpeg/lib cd ../
4、安装libpng
yum install libpng libpng-devel
5、安装freetype2
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.7.tar.gz tar -xzvf freetype-2.7.tar.gz cd freetype-2.7 ./configure --prefix=/usr/local/freetype make && make install make clean && make distclean cd ../
第二步 安装gd扩展
$ cd [php安装目录] $ cd 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 $ make $ make install
安装成功后返回gd的安装位置:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
第三步 启用gd扩展
然后打开/alidata/server/php-5.5.38/etc/php.ini
在
;extension=/path/to/extension/msql.so
附近添加在一行
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
最后重启php-fpm服务