c mysql 二进制图片 类库_[转载]终于找到了,安装jpeglib类库老是不成功,这个应

本文就是介紹在 Linux 下安裝 GD,並配置 PHP 支援 GD

GD 安裝

第一部需要做的是先要安裝 GD 到系統內,而安裝 GD 前需要安裝 jpeg-6b,

libpng, zlib, freetype。以下是下載網址:

GD

2.0.33

jpeg-6b

libpng 1.2.8

zlib

1.2.3

freetype-2.1.10.tar.gz

建立安裝套件目錄

mkdir /usr/local/modules

下載完成後鍵入以下指令進行安裝。

安裝 zlib

#不要用–prefix指訂安裝目錄會影響GD

tar zxvf zlib-1.2.3.tar.gz

cd zlib-1.2.3

./configure

make

make install

安裝 freetype

tar zxvf freetype-2.1.10.tar.gz

cd freetype-2.1.10

./configure –prefix=/usr/local/modules/freetype

make

make install

安裝 libpng

#不要用–prefix指訂安裝目錄會影響GD

tar zxvf libpng-1.2.8-config.tar.gz

cd libpng-1.2.8-config

./configure

make

make install

安裝 jpeg-6b

tar zxvf jpegsrc.v6b.tar.gz

cd jpeg-6b

./configure –prefix=/usr/local/modules/jpeg6 –enable-shared

–enable-static

make

make install

安裝 GD

tar zxvf gd-2.0.33.tar.gz

cd gd-2.0.33

./configure –prefix=/usr/local/modules/gd

–with-jpeg=/usr/local/modules/jpeg6 –with-png –with-zlib

–with-freetype=/usr/local/modules/freetype

make

make install

下一步需要配置 PHP 。

PHP 配置

現在需要重新編譯 PHP,並選擇支援 GD,如果系統內已刪除了 PHP

的原始碼,可以到 php.net 下載,然後輸入以下指令:

請在configure 後加上如下

–with-gd=/usr/local/modules/gd

–with-jpeg-dir=/usr/local/modules/jpeg6 –with-zlib –with-png

–with-freetype-dir=/usr/local/modules/freetype

其餘請自行加入

tar zxvf php-4.4.1.tar.gz

cd php-4.4.1

./configure 如上指令

make

make install

以上在 ./configure

裡的選項只可以參考,在編譯時必須根據自己的環境配置而修改,而

–with-gd 及 –with-zlib-dir=/usr/local 就是設定成支援 GD。

====================================================

歡迎轉載,但轉載時請保留此宣告,不得作為商業用途

作者: Sam Tang

來源網站: http://www.phpdc.com/

——————————————————————————–

Posted under: Linux

7 comments

zeebit:

您好:

看了你的教程,还是有问题,特请教:

我的一个RHELas4装的时候可能选的包有问题,Apache,vsftpd等配好后,发现GD库有问题(在一个图片管理程序中提示:GD

support enabled; but not installed on your server.)

通过rpm -qa|grep *,显示显示如下内容已经安装:

libpng-devel-1.2.7-1

libpng-1.2.7-1

zlib-1.2.1.2-1

zlib-devel-1.2.1.2-1

libjpeg-6b-33

libjpeg-devel-6b-33

gd-devel-2.0.28-4

gd-2.0.28-4

gcc-3.4.3-9.EL4

libgcc-3.4.3-9.EL4

装了这些(都是RHELas4自带的RPM包)GD库应用还是出错!

用PHPINFO()查看,没有发现GD大的栏目(在Windows里我装过GD,有一个大的栏目,类似这样的

gd

GD Support Enabled

GD Version 1.6.2 or higher

FreeType Support Enabled

FreeType Linkage With TTF library

GIF Support Enabled

JPG Support Enabled

PNG Support Enabled

WBMP Support Enabled

请问,我该怎么做?望回复,谢谢。

注:php-4.3.9-3.1不能通过rpm -e php

删除,我想通过.tar.gz包编译安装也不

行。

————————————————

22:47 2005-7-25

zeebit

zeebit@cs001.net

C.K.:

這邊的安裝都是用Tarball

建議您如要使用全部功能最好不要搭配使用rpm安裝的套件使用

一率使用Tarball安裝

全部安裝完最重要的是編譯 PHP,並選擇支援 GD

不然php是無法使用GD的

zeebit:

您好,

如果PHP也是用RPM装的,可以通过rpm -ivh php***.rpm

–force来强制重新安装实现吗?我试了,好像不行。

通过RPM包装的,不能再编译了吗?我找不到编译的路径啊:(

现在PHP也移除不了,那该怎么办呢?

C.K.:

RPM 的檔案與 Linux 發行廠商與版本

及其他相依套件之間有很大的相依性

所以你不能隨便的拿網路上得到的 RPM 檔案來安裝!

或者單獨移除某些套件

來將Apache + MySQL + PHP都使用Tarball安裝捨棄原始的RH的套件

學習中的菜鳥:

[root@Linux jpeg-6b]# ./configure

–prefix=/usr/local/modules/jpeg-6

checking for gcc… gcc

checking whether the C compiler (gcc ) works… yes

checking whether the C compiler (gcc ) is a cross-compiler…

no

checking whether we are using GNU C… yes

checking how to run the C preprocessor… gcc -E

checking for function prototypes… yes

checking for stddef.h… yes

checking for stdlib.h… yes

checking for string.h… yes

checking for size_t… yes

checking for type unsigned char… yes

checking for type unsigned short… yes

checking for type void… yes

checking for working const… yes

checking for inline… __inline__

checking for broken incomplete types… ok

checking for short external names… ok

checking to see if char is signed… yes

checking to see if right shift is signed… yes

checking to see if fopen accepts b spec… yes

checking for a BSD compatible install… /usr/bin/install -c

checking for ranlib… ranlib

checking libjpeg version number… 62

creating ./config.status

creating Makefile

creating jconfig.h

jconfig.h is unchanged

GD 2.0.33

jpeg-6b

libpng 1.2.8

zlib 1.2.3

freetype-2.1.10.tar.gz

同樣以上版本,只是沒有加上–prefix參數而已,但是在編譯GD的時候jpeglib.h和gd_jpeg.c出錯一堆。

想問如果編譯gd加上–without-jpeg的話,再編譯完php之後會有什麽不良後果?僅僅是php的jpeg相關函數無法執行嗎?

–with-gd=/usr/local/modules/gd

應該是

–with-gd-dir=/usr/local/modules/gd

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值