我试图让mod-wsgi在Apache2下运行,注意与Django一起使用它。在debian/apache2下的mod-wsgi分段错误
现在我刚刚得到一个基本的应用程序运行,并得到分段错误。任何建议如何追查错误将不胜感激,我卡住了。
这是在Debian/Lenny下的,Apache的版本,mod-wsgi和python 2.5。我已经检查并且mod-wsgi与/usr/lib/libpython2.5.so.1.0链接。我原来安装了python 2.4,但为了防止它选择了错误的版本,删除了它。
脚本文件是:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
我的配置是:
WSGIScriptAlias /myapp /var/www/test/myapp.wsgi
<Directory /var/www/test/myapp.wsgi>
Order allow,deny
Allow from all
</Directory>
,当我尝试查看此网址我看到这个在apache的错误日志。
[Fri Nov 19 09:29:58 2010] [info] mod_wsgi (pid=7190): Create interpreter 'morpheus.gateway.2wire.net|/myapp'.
[Fri Nov 19 09:29:58 2010] [info] mod_wsgi (pid=7331): Attach interpreter ''.
[Fri Nov 19 09:29:58 2010] [notice] child pid 7190 exit signal Segmentation fault (11)
Python似乎工作正常否则,我已经运行我的django应用程序内置服务器下没有问题。
仅供参考,我开始试图让我的Django应用程序运行,但遇到了这个错误:
[Fri Nov 19 08:25:08 2010] [info] mod_wsgi (pid=6861): Create interpreter 'morpheus.gateway.2wire.net|/curtana'.
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] mod_wsgi (pid=6861): Exception occurred processing WSGI script '/var/data/curtana/curtana.wsgi'.
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] File "/var/data/curtana/curtana.wsgi", line 1
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] import sys
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] ^
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] SyntaxError: invalid syntax
这似乎让我去尝试的基本应用。
感谢您的任何建议。
编辑补充,这里有一个回溯:通过mod_wsgi的文档
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb751a700 (LWP 8092)]
0xb6b3a920 in PyParser_AddToken (ps=0x8543f90, type=8, str=0x845a480 ")",
lineno=1, col_offset=39, expected_ret=0xbfffe378) at ../Parser/parser.c:274
274 ../Parser/parser.c: No such file or directory.
in ../Parser/parser.c
(gdb) backtrace
#0 0xb6b3a920 in PyParser_AddToken (ps=0x8543f90, type=8, str=0x845a480 ")",
lineno=1, col_offset=39, expected_ret=0xbfffe378) at ../Parser/parser.c:274
#1 0xb6b3ab86 in parsetok (tok=0x8535460, g=<value optimized out>, start=257,
err_ret=0xbfffe360, flags=<value optimized out>)
at ../Parser/parsetok.c:194
#2 0xb6bec5eb in PyParser_SimpleParseFileFlags (fp=0x84f3288,
filename=0x85301b0 "/var/www/test/myapp.wsgi", start=257, flags=0)
at ../Python/pythonrun.c:1404
#3 0xb6c76877 in ??() from /usr/lib/apache2/modules/mod_wsgi.so
#4 0x084f3288 in ??()
#5 0x085301b0 in ??()
#6 0x00000101 in ??()
#7 0x00000000 in ??()
谢谢格雷厄姆,你的网页有助于消除一些原因。我已经删除了唯一的其他Python实例和mod_python,但是关于使用gdb的文本帮助我获得了回溯。现在得到了我在哪里做了雹子,并使用'apt-get --reinstall'重新安装了python,现在它正在工作。一定会损坏我的安装。 – Eddie 2010-11-19 20:38:45