The reason for the failure apparently appears to be version incompatibility, partly may be due to libpng-1.6.6 being unstable and has conflict with the zlib-1.2.8 being previously installed.

I uninstalled zlib-1.2.8 and reinstalled the older but stable release zlib-1.2.7 and instead of libpng-1.6.6, downloaded and installed libpng-1.5.9 and libpng installation passed the test successfully!

There was no zlib_reset - 'inflateReset2' problem this time. Don't know if there was a better solution, but I seemed to have bypassed the problem anyway. So the ideal compatible versions are zlib-1.2.7/libpng-1.5.9 instead of zlib-1.2.8/libpng-1.6.6 which I had been trying! Hope this helps.

1、

wget "http://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

2、

wget "http://www.ijg.org/files/jpegsrc.v9.tar.gz"
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/jpeg && make && make install
mkdir -p /usr/local/jpeg/include
mkdir -p /usr/local/jpeg/lib
mkdir -p /usr/local/jpeg/bin
mkdir -p /usr/local/jpeg/man/man1

3、

wget "http://downloads.sourceforge.net/project/libpng/libpng12/1.2.50/libpng-1.2.50.tar.gz?r=http%3A%2F%2Fwww.libpng.org%2Fpub%2Fpng%2Flibpng.html&ts=1376631135&use_mirror=nchc"

tar zxvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libpng && make && make install
./configure --with-php-configure=/usr/local/php/bin/php-config  --with-jpeg-dir=/usr/local/jpeg  --with-png-dir=/usr/local/libpng   --with-freetype-dir=/usr/local/freetype
或者
./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

1. freetype

2 tar jxvf freetype-2.4.0.tar.bz2
3 cd freetype-2.4.0
4 ./configure --prefix=/usr/local/freetype && make && make install

2. jpegsrc

2 tar zxvf jpegsrc.v9.tar.gz
3 cd jpeg-9
4 CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/jpeg && make && make install
5 mkdir -p /usr/local/jpeg/include
6 mkdir -p /usr/local/jpeg/lib
7 mkdir -p /usr/local/jpeg/bin
8 mkdir -p /usr/local/jpeg/man/man1

3. libpng

2 tar zxvf libpng-1.2.50.tar.gz
3 cd libpng-1.2.50
4 CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libpng && make && make install

接下来需要cd到php源码的 gd 目录,否则会报 cannot find config.m4 之类的错误。

1 cd php-5.3.6
2 cd ext
3 cd gd

然后再这个目录执行命令 /usr/local/php/bin/phpize。什么时候需要用到 phpize 呢?当我们需要再加些模块,又不想重新编译php,这些我们就可以用phpize了。我的PHP安装在 /usr/local/php/ 这个目录里,可以根据个人情况修改。

1 /usr/local/php/bin/phpize

现在可以进行单独编译安装了:

1 ./configure --with-php-configure=/usr/local/php/bin/php-config  --with-jpeg-dir=/usr/local/jpeg  --with-png-dir=/usr/local/libpng   --with-freetype-dir=/usr/local/freetype
2 或者
3 ./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
4 make && make install

接着修改php.ini文件 在 ;extension=php_zip.dll 下面添加一行 extension=gd.so

重启 Nginx 之后再看看是否安装成功了。再执行 /usr/local/php/bin/php -m 查看gd模块是否加载成功。

1 service nginx restart
2 /usr/local/php/bin/php -m

console列出:

01 [root@nowamagic gd]# /usr/local/php/bin/php -m
02 [PHP Modules]
03 Core
04 ctype
05 date
06 dom
07 ereg
08 fileinfo
09 filter
10 gd
11 ……

zlib-1.2.7/libpng-1.5.9 instead of zlib-1.2.8/libpng-1.6.6的更多相关文章

  1. linux x64下编译libjpeg,libpng,zlib

    libJpeg编译: 下载libjpeg源码:http://www.ijg.org/,下载jpegsrc.v9a.tar.gz 解压源码,命令:tar -zxvf jpegsrc.v9a,源码文件夹为 ...

  2. libpng使用

    自己的实现 unsigned int component(png_const_bytep row, png_uint_32 x, unsigned int c, unsigned int bit_de ...

  3. Visual Studio 2015 下 编译 libpng

    libpng https://github.com/glennrp/libpng zlib https://github.com/madler/zlib/releases https://github ...

  4. ZLIB 库

    zlib 编辑 zlib是提供数据压缩用的函式库,由Jean-loup Gailly与Mark Adler所开发,初版0.9版在1995年5月1日发表.zlib使用DEFLATE算法,最初是为libp ...

  5. VC++编译libpng

    目录 第1章简介    1 第2章 Visual C++6.0    2 2.1 打开项目    2 2.2 编译宏    3 2.2.1 小结    5 第3章 Visual C++2010     ...

  6. libpng处理png图片(一)

    一:libpng库的编译 环境:windows10 + VS2013 需要下载:libpng, zlib两个库 下载地址: libpng:http://libmng.com/pub/png/libpn ...

  7. VC6 下 libpng 库的编译与初步使用

      VC6 下 libpng 库的编译与初步使用 目录 libong 库的介绍 VC6 下 libpng 的编译 下载 libpng 与 zlib 进行编译 得到 .lib 文件 初步使用 对 VC6 ...

  8. 安装libpng库

    一. 安装libpng库前需要先安装zlib库,libpng库依赖zlib库 1.1. zlib库安装 1.1.1. 下载地址:http://www.zlib.net/ 1.1.2. 解压后得到zli ...

  9. 在Windows上编译最新的CURL,含有zlib,openssl

    最近,从网上下载了一个curl库,使用时各种报错,都无法启动,于是干脆就直接自己编译了. 1. 准备工作 a. 下载zlib zlib可以使得HTTP请求支持gzip压缩,其地址如下: 官网:http ...

  10. [充电][库]Zlib文件压缩和解压

    原文链接: http://www.cnblogs.com/fairycao/archive/2009/12/09/1620414.html 开源代码:http://www.zlib.net/zlib使 ...

随机推荐

  1. Web Mercator Non-Conformal, Non-Mercator

    public static void XYtoGL(Coordinate coordinate) { double R = 6378137; coordinate.x = coordinate.x / ...

  2. Android系统属性简介

    查看Android源码你会发现,代码中大量存在:SystemProperties.set()/SystemProperties.get():通过这两个接口可以对系统的属性进行读取/设置,顾名思义系统属 ...

  3. 超简单,spring boot 添加mybatis

    看了很多人写的博客,要么太复杂,要么没有添加xml的方式,自己亲自配置了一下,供各位参考. 项目截图 1.添加pom文件 <!-- 设置mybatis --> <dependency ...

  4. postgres创建表的过程以及部分源码分析

    背景:修改pg内核,在创建表时,表名不能和当前的用户名同名. 首先我们知道DefineRelation此函数是最终创建表结构的函数,最主要的参数是CreateStmt这个结构,该结构如下 typede ...

  5. TCP三次握手/四次挥手详解

    一. TCP/IP协议族 TCP/IP是一个协议族,通常分不同层次进行开发,每个层次负责不同的通信功能.包含以下四个层次: 1. 链路层,也称作数据链路层或者网络接口层,通常包括操作系统中的设备驱动程 ...

  6. FTP概述

    FTP是什么? 早期三大网络应用之一:ftp(40年).http.mail ftp file transfer protocol 文件传输协议 FTP服务概述 C/S模型 客户端-服务器 FTP采用双 ...

  7. Python简单爬虫入门三

    我们继续研究BeautifulSoup分类打印输出 Python简单爬虫入门一 Python简单爬虫入门二 前两部主要讲述我们如何用BeautifulSoup怎去抓取网页信息以及获取相应的图片标题等信 ...

  8. shell编程常用的截取字符串操作

    1.          常用的字符串操作 1.1.           替换字符串:$ echo ${var/ /_}#支持正怎表达式 / /表示搜索到第一个替换,// /表示搜索到的结果全部替换. ...

  9. eclipse 启动到loading workbench... 自动关闭

    是由于项目没有正常关闭运行而导致"workbench.xmi"中的"persistedState"标签还保持在运行时的配置造成的. 解决方法: 找到<wo ...

  10. Unity性能优化(3)-官方教程Optimizing garbage collection in Unity games翻译

    本文是Unity官方教程,性能优化系列的第三篇<Optimizing garbage collection in Unity games>的翻译. 相关文章: Unity性能优化(1)-官 ...