我编译自己的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
,但我给它提供了正确的库目录(--with-jpeg-dir=/usr/lib/
),它没有接收到它们,所以我猜它们不可能是正确的版本。
rpm
说已经安装了libjpeg。我是否应该yum remove
并重新安装它,以及它的所有依赖包?这能解决这个问题吗?
下面是一个粘贴箱,里面有一系列有用的系统信息:
为服务器故障( https://serverfault.com/q/304310/92291 )的交叉发布道歉,尽管我试图了解Stack Exchange在交叉发布方面的立场,但并不清楚:https://meta.stackexchange.com/q/75326/167958
发布于 2011-09-15 01:25:51
根据要求:
有时,配置脚本是愚蠢的,您必须使用-- of =/usr而不是...=/usr/lib,因为配置测试是以providedpath + '/lib/‘的形式编写的,而不仅仅是内部提供的路径。您可能需要深入了解configure测试套件,以找出真正需要的是什么
发布于 2013-02-16 22:55:25
别忘了做一个
make clean
在您配置之后。
我已经做了一些其他的配置和使之前和旧的安装阻止我得到的jpeg支持在GD上启用。
它节省了我在ubuntu 12.04 64位上的开销
我还使用了这些包:
aptitude install libjpeg62-dev libpng-dev libfreetype6-dev
使用此配置选项:
./configure \
--with-config-file-path=/usr/local/apache2/conf \
--with-jpeg-dir \
--with-png-dir \
--with-vpx-dir \
--with-freetype-dir \
--enable-apc \
--enable-bcmath \
--enable-calendar \
--enable-dba \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-shmop \
--enable-sigchild \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-zip \
--enable-gd-native-ttf \
--with-gd \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-bz2 \
--with-curl \
--with-gettext \
--with-mcrypt \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-openssl \
--with-pdo-mysql \
--with-xmlrpc \
--with-zlib
然后:
make clean
make
make install
在Apache 2.4.3和PHP 5.4.11上运行良好
发布于 2011-08-24 05:39:53
您很可能需要安装libjpeg的开发版本,而不是运行时版本(当然,编译后需要运行时版本)。
我自己并不使用CentOS,但是像这样的东西应该会有帮助:
rpm install libjpeg-devel
我可能把包的名字弄错了,但是要找一个带有-dev
或-devel
后缀的包。
https://stackoverflow.com/questions/7167860
复制相似问题