Compiling PHP with GD and libjpeg support(使用 GD 和 libjpeg 支持编译 PHP)
问题描述
我编译自己的 PHP,部分是为了了解更多关于 PHP 是如何组合在一起的,部分是因为我总是发现我需要默认情况下不可用的模块,而通过这种方式我可以控制它.
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.
我的问题是我无法在 PHP 中获得 JPEG 支持.使用 CentOS 5.6.这是我在编译 PHP 5.3.8 时的配置选项:
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/'
./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 支持:
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] =>
)
我知道 PHP 需要能够找到 libjpeg,但它显然无法找到它满意的版本.我会认为 /usr/lib/libjpeg.so
或 /usr/lib/libjpeg.so.62
会是它需要的,但我提供了正确的lib 目录 (--with-jpeg-dir=/usr/lib/
) 并且它没有拾取它们,所以我猜它们不可能是正确的版本.
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
表示已安装 libjpeg.我应该 yum remove
并重新安装它,以及它的所有依赖包吗?这能解决问题吗?
rpm
says libjpeg is installed. Should I yum remove
and reinstall it, and all it's dependent packages? Might that fix the problem?
这是一个粘贴箱,其中收集了一些有用的系统信息:
http://pastebin.com/ied0kPR6
Here's a paste bin with a collection of hopefully useful system information:
http://pastebin.com/ied0kPR6
对于与服务器故障交叉发布的道歉(https://serverfault.com/q/304310/92291)尽管我试图了解 Stack Exchange 在交叉发布方面的立场,但并不清楚:https://meta.stackexchange.com/q/75326/167958
Apologies for cross-posting with Server Fault ( https://serverfault.com/q/304310/92291 ) although I tried to discover what Stack Exchange's position on cross-posting was and it wasn't clear: https://meta.stackexchange.com/q/75326/167958
推荐答案
按要求:
有时配置脚本很笨,你必须使用--with-somelib=/usr 而不是...=/usr/lib,因为配置测试写成providedpath + '/lib/' 而不是只是在内部提供了路径.您可能需要在配置测试套件中四处挖掘才能找出真正需要的内容
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
这篇关于使用 GD 和 libjpeg 支持编译 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 GD 和 libjpeg 支持编译 PHP
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Laravel 仓库 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01