阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

为PHP配置GD库

150次阅读
没有评论

共计 4224 个字符,预计需要花费 11 分钟才能阅读完成。

安装 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 参数

为 PHP 配置 GD 库

生产环境实用之 LNMP 架构的编译安装 +SSL 加密实现 http://www.linuxidc.com/Linux/2013-05/85099.htm

LNMP 全功能编译安装 for CentOS 6.3 笔记 http://www.linuxidc.com/Linux/2013-05/83788.htm

CentOS 6.3 安装 LNMP (PHP 5.4,MyySQL5.6) http://www.linuxidc.com/Linux/2013-04/82069.htm

在部署 LNMP 的时候遇到 Nginx 启动失败的 2 个问题 http://www.linuxidc.com/Linux/2013-03/81120.htm

Ubuntu 安装 Nginx php5-fpm MySQL(LNMP 环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm

《细说 PHP》高清扫描 PDF+ 光盘源码 + 全套教学视频 http://www.linuxidc.com/Linux/2014-03/97536.htm

PHP 的详细介绍 :请点这里
PHP 的下载地址 :请点这里

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计4224字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中