mod_wsgi : mod_wsgi-express 错误 : '加载了多个 MPM
我现在正在尝试通过这个页面的步骤来安装mod_wsgi,链接是https://github.com/GrahamDumpleton/mod_wsgi(看起来是官方页面)。
我用命令pip install mod_wsgi
安装完后,输入命令mod_wsgi-express start-server
来检查它是否能运行。
结果似乎没有运行,我遇到了一个错误:
root@vpsxxxx:/# mod_wsgi-express start-server
Server URL : http://localhost:8000/
Server Root : /tmp/mod_wsgi-localhost:8000:0
Server Conf : /tmp/mod_wsgi-localhost:8000:0/httpd.conf
Error Log : /tmp/mod_wsgi-localhost:8000:0/error_log
AH00534: apache2: Configuration error: More than one MPM loaded.
如你所见,我是以root身份运行的,但如果我用mod_wsgi-express start-server wsgi.py --port=80 --user www-data --group www-data
命令,还是会出现同样的错误。
有没有什么想法?
编辑: 可能在安装过程中出现了问题:
/usr/include/python2.7/object.h:822:38: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
root@vpsxxxx:~# pip install mod_wsgi
Downloading/unpacking mod-wsgi
Downloading mod_wsgi-4.2.1.tar.gz (1.1MB): 1.1MB downloaded
Running setup.py (path:/tmp/pip_build_root/mod-wsgi/setup.py) egg_info for package mod-wsgi
Downloading/unpacking mod-wsgi-metrics>=1.0.0 (from mod-wsgi)
Downloading mod_wsgi-metrics-1.0.0.tar.gz
Running setup.py (path:/tmp/pip_build_root/mod-wsgi-metrics/setup.py) egg_info for package mod-wsgi-metrics
Installing collected packages: mod-wsgi, mod-wsgi-metrics
Running setup.py install for mod-wsgi
building 'mod_wsgi.server.mod_wsgi-py27' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_daemon.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_daemon.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_stream.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_stream.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_apache.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_apache.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/mod_wsgi.c -o build/temp.linux-x86_64-2.7/src/server/mod_wsgi.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
In file included from /usr/include/python2.7/Python.h:80:0,
from src/server/wsgi_python.h:24,
from src/server/mod_wsgi.c:22:
src/server/mod_wsgi.c: In function ‘Dispatch_ssl_var_lookup’:
/usr/include/python2.7/object.h:822:38: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
^
src/server/mod_wsgi.c:5555:9: note: in expansion of macro ‘Py_XINCREF’
Py_XINCREF(Py_None);
^
/usr/include/python2.7/object.h:822:38: warning: the comparison will always evaluate as ‘false’ for the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress]
#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0)
^
src/server/mod_wsgi.c:5564:9: note: in expansion of macro ‘Py_XINCREF’
Py_XINCREF(Py_None);
^
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_logger.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_logger.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_convert.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_convert.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_metrics.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_metrics.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_restrict.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_restrict.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_server.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_server.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_validate.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_validate.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_interp.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_interp.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/apache2 -I/usr/include/python2.7 -c src/server/wsgi_buckets.c -o build/temp.linux-x86_64-2.7/src/server/wsgi_buckets.o -I/usr/include/apache2 -I. -I/usr/include/apr-1.0 -I/usr/include -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -pthread
src/server/wsgi_buckets.c: In function ‘wsgi_python_bucket_setaside’:
src/server/wsgi_buckets.c:151:5: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘apr_off_t’ [-Wformat=]
fprintf(stderr, "start=%lld\n", b->start);
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/server/wsgi_daemon.o build/temp.linux-x86_64-2.7/src/server/wsgi_stream.o build/temp.linux-x86_64-2.7/src/server/wsgi_apache.o build/temp.linux-x86_64-2.7/src/server/mod_wsgi.o build/temp.linux-x86_64-2.7/src/server/wsgi_logger.o build/temp.linux-x86_64-2.7/src/server/wsgi_convert.o build/temp.linux-x86_64-2.7/src/server/wsgi_metrics.o build/temp.linux-x86_64-2.7/src/server/wsgi_restrict.o build/temp.linux-x86_64-2.7/src/server/wsgi_server.o build/temp.linux-x86_64-2.7/src/server/wsgi_validate.o build/temp.linux-x86_64-2.7/src/server/wsgi_interp.o build/temp.linux-x86_64-2.7/src/server/wsgi_buckets.o -o build/lib.linux-x86_64-2.7/mod_wsgi/server/mod_wsgi-py27.so -L/usr/lib -L/usr/lib/python2.7/config -lpython2.7
Installing mod_wsgi-express script to /usr/local/bin
Running setup.py install for mod-wsgi-metrics
Successfully installed mod-wsgi mod-wsgi-metrics
Cleaning up...
真是糟糕。
1 个回答
1
Graham Dumpleton刚刚更新了这个代码库,并解决了这个问题,所以请考虑更新你的python mod_wsgi模块,这样就能修复你的问题。
在后台运行mod-wsgi模块的python代码试图添加多个MPM,但实际上已经添加了一个,结果没有按预期跳出循环。
这里是相关的代码
def _mpm_module_defines(modules_directory):
result = []
workers = ['event', 'worker', 'prefork']
for name in workers:
if os.path.exists(os.path.join(modules_directory,
'mod_mpm_%s.so' % name)):
result.append('-DWSGI_MPM_%s_MODULE' % name.upper())
return result
这段代码没有考虑到系统上安装了多个Apache模块(比如event、worker和prefork)的情况。现在代码在添加后增加了一个“break”,这样就能正确跳出循环了。