本文介绍了mod_wsgi:mod_wsgi-express错误:“已加载多个MPM"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在按照此页面中的步骤尝试在python中安装mod_wsgi https://github.com/GrahamDumpleton /mod_wsgi (似乎是官方页面).

I am currently trying to install mod_wsgi in python by following steps in this page https://github.com/GrahamDumpleton/mod_wsgi (seems to be the official page).

使用pip install mod_wsgi安装后,我键入命令mod_wsgi-express start-server来检查它是否运行.

After installing with pip install mod_wsgi, I type command mod_wsgi-express start-server to check if it runs.

它似乎没有运行,并且出现错误:

It seems not running and I have an error :

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,我也会遇到相同的错误.

As you can see, I am root, but I have the same error If I do mod_wsgi-express start-server wsgi.py --port=80 --user www-data --group www-data.

有什么主意吗?

也许在安装过程中出现了问题:

Edit :Maybe there's a problem during installation:

/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...

Doom.

推荐答案

Graham Dumpleton刚刚更新了存储库并处理了此问题,因此请考虑更新python mod_wsgi模块,以解决您的问题.

Graham Dumpleton has just updated the repo and dealt with this problem, so please consider updating your python mod_wsgi module which will fix your issue.

已经在后端上运行mod-wsgi模块的python代码试图添加一个以上的MPM,而不是像预期的那样打破循环.

The python code running the mod-wsgi module on the backend is trying to add more than one MPM, after already having added one, instead of breaking out of the loop as intended.

这是有问题的代码

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 mod(事件,工作程序和prefork)时,未考虑该代码.现在,该代码在追加之后带有一个中断".

The code had not taken into account when multiple Apache mods (event and worker and prefork) were installed on the system. The code now has a "break" after the append.

这篇关于mod_wsgi:mod_wsgi-express错误:“已加载多个MPM"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 17:15