【发布时间】:2011-11-02 07:54:54
【问题描述】:
我编译自己的 PHP,部分是为了了解更多关于 PHP 是如何组合在一起的,部分是因为我总是发现我需要默认不可用的模块,而这样我可以控制它。
我的问题是我无法在 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 输出显示:
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
然后我们可以看到 GD 已安装,但不存在 JPEG 支持:
# 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] =>
)
我知道 PHP 需要能够找到 libjpeg,但它显然无法找到它满意的版本。我原以为/usr/lib/libjpeg.so 或/usr/lib/libjpeg.so.62 会是它所需要的,但我为它提供了正确的lib 目录(--with-jpeg-dir=/usr/lib/)并且它没有选择它们所以我猜它们不可能是正确的版本.
rpm 表示已安装 libjpeg。我应该yum remove 并重新安装它,以及它的所有依赖包吗?这能解决问题吗?
这是一个粘贴箱,里面收集了一些有用的系统信息:
http://pastebin.com/ied0kPR6
为服务器故障 (https://serverfault.com/q/304310/92291) 的交叉发布致歉,尽管我试图了解 Stack Exchange 在交叉发布方面的立场,但不清楚:https://meta.stackexchange.com/q/75326/167958
【问题讨论】:
-
有时配置脚本很笨,你必须使用
--with-somelib=/usr而不是...=/usr/lib,因为配置测试在内部编写为@987654336@ 而不仅仅是providedpath。您可能必须在配置测试套件中四处寻找才能找出真正需要的内容。 -
我试过
--with-jpeg-dir=/usr。它确实输出了checking for the location of libjpeg... /usr,但它仍然不支持JPEG。我不知道在哪里查看配置脚本的课程代码 - 你知道我在哪里可以找到它吗? -
应该是 configure.in 文件或类似的文件,其中列出了配置脚本应该执行的测试。
-
是的!我认为这是解决方案。我设置了
--with-jpeg-dir=/usr/local/,现在它可以工作了!请将此解决方案作为答案发布,我会接受。 -
@marc-b 您的解决方案帮助我解决了我的问题,因为 PHP 似乎想要我从
/usr/local/lib/libjpeg.so.8的源代码编译的libjpeg。我曾尝试告诉它将那个与--with-jpeg-dir=/usr/local/lib/一起使用但没有成功,但根据您的评论,我尝试了--with-jpeg-dir=/usr/local/,它奏效了。 :) 谢谢。
标签: php gd compilation centos libjpeg