热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

升级Ubuntu系统中的GD库到完整版

一般情况下我们在Ubuntu的Linux发行版本中安装LAMPP环境都是直接通过apt-get的方式来进行安装(方便,可以偷懒!呵呵)!虽然很方便,但是在这些集成版本中多多少少也存在一些问题。比方说PHP5-GD库~我们安装好后发现phpinfo中的提示是2.0orhigher.虽然大部分的功能都有,但是这个库并不完整。在一次西林我做Drupal项目中就出现Drupal

一般情况下我们在Ubuntu的Linux发行版本中安装LAMPP环境都是直接通过apt-get的方式来进行安装(方便,可以偷懒!呵呵)!

虽然很方便,但是在这些集成版本中多多少少也存在一些问题。

比方说PHP5-GD库~ 我们安装好后发现phpinfo中的提示是 2.0 or higher. 虽然大部分的功能都有,但是这个库并不完整。

在一次西林我做 Drupal项目中就出现 Drupal 报错,导致image模块的部分功能缺失!开始还很诧异,问了一下朋友,朋友说应该不会出现这样的问题(后来才知道,他一直都是编译安装 T-T)。

报错的信息如下:

GD Image Filtering 和 GD Image Rotation 无法正常工作,系统提示的意思为该GD库版本不是官方的发行版本!

于是我开始在网上找这方面的问题,发现所有的Ubuntu和debian用户都存在这样的问题。

因为使用DRUPAL国内用户少,所以问题不是很明显。去国外的一些网站查的时候找到了解决办法。(E文太差,找起来费劲!)

主要问题就在GD库上,很多人说APT包中的GD库是被修改过的,然后再编译整合。所以会出现不能功能的缺失。既然找到问题所在了就有办法解决。我在 Cumu.li 的网站上看到他提出的解决办法。BLOG原文如下:

I’ve been installing the LAMP stack on an Ubuntu based server for a client. They rely on the version of LibGD that’s bundled with PHP5. This version includes certain functions including imagerotate()  and others.

It seems that the people who build Ubuntu (and Debian) distribution do not want to compile PHP5 with the version of GD that comes bundled with PHP5. As far as I can tell the guys at Ubuntu (and Debian) consider this to be a fork of the original GD library and think that this could be a security risk. Their stance on it is that if PHP want to use this version then they should contribute the changes that have been made to the original GD library back to the core project. This seems fair enough, but unfortunately I can’t immediately change the direction of an open source project this big – or probably any project, come to think about it!

After a bit of rummaging around on the Internet I found nothing to do with actually compiling in this support, so I tried to work out how to do this… In theory! I found a link on Ubuntu forums about including the GMP library I roughly followed this through.

(西林我的E文水平差就不献丑翻译了!基本就是建议大家重新下载源码,然后在编译打包!)

具体操作如下:

先下载个源码包
# Install build tools, debian helpers and fakeroot
apt-get install build-essential debhelper fakeroot
# source code should reside in /usr/src
cd /usr/src
# Download PHP source
apt-get source php5
# Install all packages required to build PHP5
apt-get build-dep php5
cd php5-5.2.3


推荐阅读
author-avatar
欣欣然人人宇
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有