简体   繁体   English

麻烦mod_wsgi

[英]Trouble with mod_wsgi

I'm working on a Linux Centos virtual host with Hostgator. 我正在使用Hostgator开发Linux Centos虚拟主机。 I'm using httpd version 2.2.15. 我正在使用httpd 2.2.15版。

I configured mod_wsgi-4.4.13 with tags --with-python=/usr/local/bin/python2.7 and --enable-shared . 我使用标签--with-python=/usr/local/bin/python2.7--enable-shared配置了mod_wsgi-4.4.13。 Python 2.6 is installed in /usr/bin . Python 2.6安装在/usr/bin I have a symlink from /usr/local/lib/python2.7/config/libpython2.7.so.1.0 to /usr/local/lib/libpython.2.7.so.1.0 . 我有一个从/usr/local/lib/python2.7/config/libpython2.7.so.1.0/usr/local/lib/libpython.2.7.so.1.0的符号链接。

My trouble is that when I run python 'index.fcgi' in /var/www/html , I get the error 我的麻烦是,当我在/var/www/html运行python 'index.fcgi'时,出现错误

from mod_wsgi import get_wsgi_application ImportError: /usr/lib64/httpd/modules/mod_wsgi.so: undefined symbol: apr_bucket_shared_split 从mod_wsgi导入get_wsgi_application ImportError:/usr/lib64/httpd/modules/mod_wsgi.so:未定义的符号:apr_bucket_shared_split

I've tried setting $PYTHONHOME to /usr/local . 我尝试将$PYTHONHOME设置$PYTHONHOME /usr/local I've already set the $LIBRARY_LD_PATH variable (before doing that I couldn't get the library at all). 我已经设置了$LIBRARY_LD_PATH变量(在此之前,我根本无法获得该库)。 I'm really not sure what to do next. 我真的不确定下一步该怎么做。 Please help! 请帮忙!

Thank you. 谢谢。

You have the following issues. 您有以下问题。

1 - The --enable-shared is not used with mod_wsgi build, but with the configure script of Python when building it. 1--- --enable-shared不用于mod_wsgi构建,而是用于构建时的Python configure脚本。 For more details see: 有关更多详细信息,请参见:

2 - From memory the shared library for Python should already gave been linked into /usr/local/lib . 2-应该已经将来自内存的Python共享库链接到/usr/local/lib If it isn't something has gone wrong with your Python install. 如果不是,那么您的Python安装出现了问题。 Even when installed in an alternate location such that the library isn't on the normal shared library search path, rather than symlinking the libpython.2.7.so.1.0 into an appropriate directory, you are better off setting LD_RUN_PATH environment variable when building mod_wsgi from clean source code to be the directory where the Python shared library is. 即使将其安装在备用位置(例如,该库不在正常的共享库搜索路径上),而不是将libpython.2.7.so.1.0符号链接到适当的目录中,您也最好在从以下位置构建mod_wsgi时设置LD_RUN_PATH环境变量干净的源代码将成为Python共享库所在的目录。 See: 看到:

3 - A .fcgi file has got nothing to do with mod_wsgi, so why are you running python index.fcgi in the first place? 3- .fcgi文件与mod_wsgi没有任何关系,那么为什么首先要运行python index.fcgi

4 - Nothing tells you to put in your code: 4-没有任何内容告诉您输入代码:

from mod_wsgi import get_wsgi_application

Where did you see that you needed to do that? 您在哪里看到您需要这样做? Why that is even loading mod_wsgi.so I don't know as Python shouldn't be able to find it in the Apache modules directory like that as that directory isn't on the normal Python module search path. 为什么还要加载mod_wsgi.so我不知道Python不能在Apache modules目录中找到它,因为该目录不在普通的Python模块搜索路径中。

In short, you appear to be doing things you haven't told us and what you are doing isn't what mod_wsgi documentation tells you to do. 简而言之,您似乎正在做您未告诉我们的事情,而您正在做的事情并不是mod_wsgi文档告诉您的事情。 Please provide a pointer to the part of the official mod_wsgi documentation that you are using to set things up. 请提供指向官方mod_wsgi文档中用于设置内容的指针。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM