编译PHP与GD和libjpeg支持 [英] Compiling PHP with GD and libjpeg support

查看:547
本文介绍了编译PHP与GD和libjpeg支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编译自己的PHP,部分是为了更多地了解PHP如何组合在一起,部分是因为我总是发现我需要默认不可用的模块,这样我就可以控制。 p>

我的问题是我无法在PHP中获得JPEG支持。使用CentOS 5.6。以下是编译 PHP 5.3.8 时的配置选项:

 './configure''--enable-fpm''--enable-mbstring''--with-mysql' '--with-mysqli''--with-gd''--with-curl''--with-mcrypt''--with-zlib''--with-pear''--with-gmp'' --with-xsl''--enable-zip''--disable-fileinfo''--with-jpeg-dir = / usr / lib /'

./ configure 输出说明:

 检查GD支持...是
检查libjpeg的位置... no
检查libpng的位置... no
检查libXpm的位置... no

然后我们可以看到GD已安装,但JPEG支持不存在:

 #php -r'print_r(gd_info());'
Array

[GD Version] => bundled(2.0.34 compatible)
[FreeType支持] =>
[T1Lib支持] =>
[支持] => 1
[GIF Create Support] => 1
[JPEG支援] =>
[PNG支持] => 1
[WBMP支持] => 1
[XPM Support] =>
[XBM Support] => 1
[JIS映射日语字体支持] =>



我知道PHP需要能够找到libjpeg,找到一个它很高兴的版本。我会想到 /usr/lib/libjpeg.so /usr/lib/libjpeg.so.62 会是我们需要的,但是我提供了正确的lib目录( - with-jpeg-dir = / usr / lib / 所以我想他们不能是正确的版本。



rpm 说libjpeg安装。我应该 yum删除并重新安装它,它的所有依赖包吗?



这是一个粘贴箱,其中包含一些有用的系统信息:

http://pastebin.com/ied0kPR6



对于具有服务器故障的交叉发布抱歉( http://serverfault.com/q/304310/92291 )虽然我试图发现Stack Exchange的位置在交叉发布是什么,它wasn' t clear: http://meta.stackexchange.com/q/75326/167958

$ b



有时配置脚本是哑的,你必须做 - -with-somelib = / usr而不是... = / usr / lib,因为配置测试被写为providedpath +'/ lib /',而不是内部的providedpath。您可能需要在配置测试套件中深入了解哪些是真正需要的


I compile my own PHP, partly to learn more about how PHP is put together, and partly because I'm always finding I need modules that aren't available by default, and this way I have control over that.

My problem is that I can't get JPEG support in PHP. Using CentOS 5.6. Here are my configuration options when compiling PHP 5.3.8:

 './configure'  '--enable-fpm' '--enable-mbstring' '--with-mysql' '--with-mysqli' '--with-gd' '--with-curl' '--with-mcrypt' '--with-zlib' '--with-pear' '--with-gmp' '--with-xsl' '--enable-zip' '--disable-fileinfo' '--with-jpeg-dir=/usr/lib/'

The ./configure output says:

checking for GD support... yes
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no

And then we can see that GD is installed, but that JPEG support isn't there:

# php -r 'print_r(gd_info());'
Array
(
    [GD Version] => bundled (2.0.34 compatible)
    [FreeType Support] =>
    [T1Lib Support] =>
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] =>
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] =>
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] =>
)

I know that PHP needs to be able to find libjpeg, and it obviously can't find a version it's happy with. I would have thought /usr/lib/libjpeg.so or /usr/lib/libjpeg.so.62 would be what it needs, but I supplied it with the correct lib directory (--with-jpeg-dir=/usr/lib/) and it doesn't pick them up so I guess they can't be the right versions.

rpm says libjpeg is installed. Should I yum remove and reinstall it, and all it's dependent packages? Might that fix the problem?

Here's a paste bin with a collection of hopefully useful system information:
http://pastebin.com/ied0kPR6

Apologies for cross-posting with Server Fault ( http://serverfault.com/q/304310/92291 ) although I tried to discover what Stack Exchange's position on cross-posting was and it wasn't clear: http://meta.stackexchange.com/q/75326/167958

解决方案

as requested:

Sometimes the configure script is dumb, and you have to do --with-somelib=/usr instead of ...=/usr/lib, because the config test is written as providedpath + '/lib/' rather than just providedpath internally. You may have to dig around inside the configure test suite to find out what's really required

这篇关于编译PHP与GD和libjpeg支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆