是否有可能控制哪个库apache的用途? [英] Is it possible to control which libraries apache uses?
问题描述
好了,所以我有一个<一个href=\"http://stackoverflow.com/questions/2110588/getting-invalid-image-error-in-django-but-pil-is-installed-and-passes-all-tests\">earlier与PIL 的问题仍然没有得到解决。别人有这个问题,不得不通过的删除旧的JPEG库。我真的不能做我的机器上,但是,因为它的RHEL和这么多事情都依赖libjpeg和libjpeg的-DEVEL(当我试图百胜删除的libjpeg刚刚看到,一共有252包,将已经有去掉!)
Okay, so I had an earlier problem with PIL that is still unresolved. Someone else had this problem and had success by removing the old JPEG library. I can't really do that on my machine, however, as it's RHEL and so many things are dependent on libjpeg and libjpeg-devel (when I tried yum remove libjpeg just to see, there were a total of 252 packages that would have been removed!)
我有JPEG-8安装在/ usr / local / lib目录。它被正确使用的蟒蛇,但不的被Apache。下面是lsof的列表:
I have jpeg-8 installed in /usr/local/lib. It's correctly being used by python, but not by apache. Here's a list from lsof:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
httpd xxxxx root mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
python xxxxx jordan DEL REG 253,3 xxxxx63 /usr/local/lib/libjpeg.so.8.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
httpd xxxxx apache mem REG 253,3 xxxxx0 xxxxx34 /usr/lib64/libjpeg.so.62.0.0
所以,这就是我想知道。既然我无法卸载的libjpeg-6B,有什么方法可以让我的力的Apache来使用的libjpeg-8呢?
So, here's what I'm wondering. Given that I can't uninstall libjpeg-6b, is there any way I can force apache to use libjpeg-8 instead?
好吧,的lsof的
所以最近的运行表明,Apache是现在载入libjpeg.so.8.0.0 同时,但仍运行到错误,这表明它依然采用了62版。是否有某种方式给8版本precedence呢?
Okay, so a recent run of lsof
shows that apache is now loading libjpeg.so.8.0.0 also but still running into errors, which suggests that it is still using the 62 version. Is there some way to give the 8 version precedence instead?
更新#1
运行 LDD
对所有在lib64的模块/模块想出了不提的libjpeg。运行 LDD
关于PIL的_imaging.so文件表明,它是通过libjpeg的新版本。我是pretty肯定,只有一个在我的系统版本PIL的 - 我已经做了pretty彻底搜索
Running ldd
against all of the modules in lib64/modules came up with no reference to libjpeg. Running ldd
on PIL's _imaging.so file showed that it is using the new version of libjpeg. I'm pretty sure there is only one version of PIL on my system -- I've done a pretty thorough search.
没有人有知道哪些程序或模块捆绑的httpd或Python有可能加载的libjpeg?我知道的的东西的是通过Apache加载它,因为它显示了在 lsof的
。
Does anyone out there know which programs or modules tied to httpd or python are likely to load libjpeg? I know that something is loading it via apache since it is showing up in lsof
.
推荐答案
有一个办法,但因为它是一个不同版本的JPEG库,你很可能要打破什么,那就是越来越加载老库第一。
There is a way, but since it is a different version of the jpeg library, you are likely going to break whatever it is that is getting to load the old library first.
问题可能是,你加载PHP到同一个Apache安装,这是preloading这对旧版本的JPEG库的依赖PHP扩展模块。由于PHP是接管什么的Python获得做precedence,你被卡住了错误的库。
The problem likely is that you are loading PHP into the same Apache installation and it is preloading a PHP extension module which has a dependency on the older version of the jpeg library. Because PHP is taking precedence over what Python gets to do, you are stuck with that wrong library.
所以,尝试禁用mod_php,并且因此它不会加载到Apache的。如果你的问题解决了,你知道它是。如果它不工作,你不需要PHP然后把它永久停用。如果您确实需要PHP,然后再转到下的FastCGI使用PHP来代替,这样你可以避免PHP被加载到Apache的过程本身。另外,您将需要更新/重建PHP使用相同的JPEG版本。
So, try disabling mod_php so it isn't loaded into Apache. If your problem goes away you know it is that. If it does work and you don't need PHP then leave it permanently disabled. If you do need PHP, then change to using PHP under fastcgi instead, that way you avoid PHP being loaded into Apache processes themselves. Alternatively, you will need to update/rebuild PHP to use the same jpeg version.
现在的黑客,以preLOAD不同版本的jpeg库,但是这很可能将无法正常工作或导致以后的问题。本hack是更改为Apache初始化脚本,这样它集:
Now for the hack to preload the different version of jpeg library, but that likely will not work or cause later problems. This hack is to change the init scripts for Apache such that it sets:
LD_PRELOAD=/some/path/libjpeg.so.8.0.0
export LD_PRELOAD
这告诉操作系统,以preLOAD该库到进程的地址空间它做任何事情之前。
This tells operating system to preload that library into process address space before it does anything.
顺便说一句,如果是PHP,你是不是有LDD发现它的原因是,PHP扩展模块安装在不同的目录到Apache的模块。
BTW, if it is PHP, the reason you aren't finding it with ldd is that the PHP extension modules are installed in a different directory to where the Apache module is.
这篇关于是否有可能控制哪个库apache的用途?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!