简体   繁体   English

Apache错误日志中的“ mod_wsgi:无法导入站点模块”

[英]“mod_wsgi : Unable to import site module” in Apache Error Logs

I am working with mod_wsgi + Python2.7. 我正在使用mod_wsgi + Python2.7。 After installing mod_wsgi, I restarted httpd. 安装mod_wsgi之后,我重新启动了httpd。 The following got printed to my Apache error log. 以下内容已打印到我的Apache错误日志中。

"mod_wsgi pid=XXXX" Unable to import 'site' module.

Hitting the IP-address yielded an 击中IP地址会产生一个

" Import error No module named os "

in the Apache error logs. 在Apache错误日志中。

I have installed mod_wsgi using yum install mod_wsgi . 我已经使用yum install mod_wsgi安装了mod_wsgi I'm aware that the nicer way to install it is by compiling it from source using the preferred Python version. 我知道更好的安装方法是使用首选Python版本从源代码进行编译。

( However, doing so failed. Running a make after the ./configure produced the following errors. (但是,这样做失败。在./configure之后运行make会产生以下错误。

/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

)

Using leads from Installation Issues , I checked whether my mod_wsgi.so installation was OK. 使用“ 安装问题”中的线索,我检查了我的mod_wsgi.so安装是否正常。

Running a 运行一个

ldd /etc/httpd/modules/mod_wsgi.so

Produced 产生的

[root@BLFLDT9454T mod_wsgi-3.4]# ldd /etc/httpd/modules/mod_wsgi.so
    libpython2.4.so.1.0 => /usr/lib64/libpython2.4.so.1.0 (0x00002b90b505d000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b90b5392000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002b90b55ae000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00002b90b57b3000)
    libm.so.6 => /lib64/libm.so.6 (0x00002b90b59b6000)
    libc.so.6 => /lib64/libc.so.6 (0x00002b90b5c39000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003530400000)

Which shows that shared libraries are in use already ( if I am not wrong ). 这表明共享库已经在使用中(如果我没记错的话)。

So where could I be going wrong? 那我哪里出问题了?

Thanks, Shoubhik 谢谢,Shoubhik

In the document you reference, it says the following: 在您引用的文档中,它表示以下内容:

IOW. IOW。 y Python installation has not been installed with --enable-shared when configure was run for Python. y在为Python运行configure时,尚未使用--enable-shared安装Python安装。

Also, you do not seem to have removed the existing mod_wsgi properly either if what is installed is still referencing Python 2.4. 另外,如果安装的内容仍然引用Python 2.4,您似乎也没有正确删除现有的mod_wsgi。

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

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