我编译自己的PHP,部分是为了了解更多关于如何将PHP放在一起,部分是因为我总是发现我需要默认情况下不可用的模块,这样我就可以控制它。
我的问题是,我不能在PHP中获得JPEG支持。 使用CentOS 5.6。 编译PHP 5.3.8时,以下是我的configuration选项:
'./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需要能够findlibjpeg,而且显然找不到它所满意的版本。 我会认为/usr/lib/libjpeg.so或/usr/lib/libjpeg.so.62将是它所需要的,但我提供了正确的lib目录( --with-jpeg-dir=/usr/lib/ ),并没有拿起他们,所以我想他们不能是正确的版本。
rpm表示libjpeg已安装。 我应该yum remove并重新安装它,所有它的依赖包? 可以解决这个问题吗?
这里有一个贴满垃圾箱的希望有用的系统信息的集合:
http://pastebin.com/ied0kPR6
如果你正在编译自己的PHP和扩展,你也需要libjpeg-devel
yum install libjpeg-devel
你需要所有你要链接和使用的库的等价类(curl-devel,zlib-devel,gmp-devel等)
我设置了--with-jpeg-dir=/usr/local/它工作正常! 它似乎添加了lib本身。