zlib-1.2.7/libpng-1.5.9 instead of zlib-1.2.8/libpng-1.6.6

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 ……
posted @ 2016-11-22 14:44  知子  阅读(854)  评论(0编辑  收藏  举报