php 配置 gd2,为PHP配置GD库

安装zlib

root@localhost:~# tar zxvf zlib-1.2.3.tar.gz

root@localhost:~# cd zlib-1.2.3/

root@localhost:~/zlib-1.2.3#

root@localhost:~/zlib-1.2.3# ./configure --prefix=/usr/local/zlib

Checking for gcc...

Building static library libz.a version 1.2.3 with gcc.

Checking for unistd.h... Yes.

Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()

Checking for vsnprintf() in stdio.h... Yes.

Checking for return value of vsnprintf()... Yes.

Checking for errno.h... Yes.

Checking for mmap support... Yes.

root@localhost:~/zlib-1.2.3# make

root@localhost:~/zlib-1.2.3# make install

安装libpng

root@localhost:~# tar jxvf libpng-1.2.8.tar.bz2

root@localhost:~/libpng-1.2.8# mv ./scripts/makefile.linux ./makefile

root@localhost:~/libpng-1.2.8# make

root@localhost:~/libpng-1.2.8# make install

安装freetype

root@localhost:~# tar zxvf freetype-2.1.10.tar.gz

root@localhost:~# cd freetype-2.1.10/

root@localhost:~/freetype-2.1.10# ./configure --prefix=/usr/local/freetype

root@localhost:~/freetype-2.1.10# make

root@localhost:~/freetype-2.1.10# make install

安装Jpeg

root@localhost:~# tar zxvf jpegsrc.v6b.tar.gz

root@localhost:~# cd jpeg-6b/

root@localhost:~/jpeg-6b# ./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static

--enable-shared参数用来设置生成共享库

root@localhost:~/jpeg-6b# make

./libtool --mode=compile gcc -O2  -I. -c ./jcapimin.c

make: ./libtool: Command not found

make: *** [jcapimin.lo] Error 127

root@localhost:/etc/apt# ls

apt.conf.d     sources.list~      sources.list.d  trusted.gpg~

preferences.d  sources.listbak    trustdb.gpg     trusted.gpg.d

sources.list   sources.list_bak2  trusted.gpg

root@localhost:/etc/apt# cp sources.list_bak2 sources.list

sources.list_bak2为我自己创建的本地源列表

root@localhost:/etc/apt# cat sources.list_bak2

deb file:///media/cdrom precise main

root@localhost:/etc/apt# apt-get update

root@localhost:/etc/apt# apt-get install libtool

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following extra packages will be installed:

autotools-dev libltdl-dev

Suggested packages:

libtool-doc autoconf automaken gfortran fortran95-compiler gcj

The following NEW packages will be installed:

autotools-dev libltdl-dev libtool

0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.

Need to get 0 B/547 kB of archives.

After this operation, 2,561 kB of additional disk space will be used.

Do you want to continue [Y/n]? Y

root@localhost:~# cd jpeg-6b/

root@localhost:~/jpeg-6b# make clean

rm -f *.o *.lo libjpeg.a libjpeg.la

rm -f cjpeg djpeg jpegtran rdjpgcom wrjpgcom

rm -f ansi2knr core testout* config.log config.status

rm -f -r knr .libs _libs

root@localhost:~/jpeg-6b# cp /usr/share/libtool/config/config.sub .

root@localhost:~/jpeg-6b# cp /usr/share/libtool/config/config.guess .

root@localhost:~/jpeg-6b# ./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static

该版本有待更正 无法自动创建安装目录,自己创建一下:

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

编译安装

root@localhost:~/jpeg-6b# make

root@localhost:~/jpeg-6b# make install

安装GD

root@localhost:~# tar zxvf gd-2.0.33.tar.gz

root@localhost:~# cd gd-2.0.33/

root@localhost:~/gd-2.0.33# ./configure --with-png --with-jpeg --with-freetype=/usr/local/freetype

root@localhost:~/gd-2.0.33# make

root@localhost:~/gd-2.0.33# make install

安装php

注:如若已经安装过php删除安装目录即可:

root@localhost:~# rm -rf /usr/local/php5

root@localhost:~# tar zxvf php-5.4.4.tar.gz

root@localhost:~# cd php-5.4.4/

root@localhost:~/php-5.4.4# ./configure --prefix=/usr/local/php5/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql5/ --enable-mbstring --with-gd --enable-gd-native-ttf --with-zlib-dir=/usr/local/zlib --with-freetype-dir=/usr/local/freetype

root@localhost:~/php-5.4.4# make

root@localhost:~/php-5.4.4# make install

root@localhost:~# /usr/local/apache2/bin/apachectl stop

root@localhost:~# /usr/local/apache2/bin/apachectl start

测试

[root@orcl10g ~]# cd /usr/local/apache2/htdocs/

输入指针函数显示php信息

[root@orcl10g htdocs]# vi index.php

写入内容如下:

phpinfo();

?>

浏览器查看有无gd参数

8f752ad57ba30be6a46b585472da309c.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值