mod_wsgi icon indicating copy to clipboard operation
mod_wsgi copied to clipboard

Cannot load modules/mod_wsgi_python3.so

Open xxinran opened this issue 3 years ago • 3 comments

Could you please help with this, I have struggled with this for several days. I was trying to install httpd.service with mod_wsgi_python3 loaded. It always occurs


● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2021-09-16 19:26:20 PDT; 8min ago
     Docs: man:httpd.service(8)
  Process: 272085 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 272085 (code=exited, status=1/FAILURE)

 systemd[1]: Starting The Apache HTTP Server...
httpd[272085]: [Thu Sep 16 19:26:20.699026 2021] [so:warn] [pid 272085:tid 140341096098112] AH01574: module proxy_uwsgi_module is already loaded, skipping
httpd[272085]: httpd: Syntax error on line 59 of /etc/httpd/conf/httpd.conf: Syntax error on line 5 of /etc/httpd/conf.modules.d/10-wsgi-python3.conf: Cannot load modules/mod_wsgi_python3.so into server: /lib64/libpython3.6m.so.1.0: rebuild shared object with IBT support enabled
httpd.service: Main process exited, code=exited, status=1/FAILURE
 httpd.service: Failed with result 'exit-code'.
 Failed to start The Apache HTTP Server.

My configuration is:

$ cat /etc/httpd/conf.modules.d/10-wsgi-python3.conf
# NOTE: mod_wsgi_python3 can not coexist in the same apache process as
# mod_wsgi (python2).  Only load if mod_wsgi is not already loaded.

<IfModule !wsgi_module>
    LoadModule wsgi_module modules/mod_wsgi_python3.so
</IfModule>

And the file /etc/httpd/modules/mod_wsgi_python3.so and /lib64/libpython3.6m.so.1.0 exist. Could you please help?

xxinran avatar Sep 17 '21 02:09 xxinran

What operating system vendor/version is this?

It appears their Python distribution is compiled in a way that prohibits embedding.

GrahamDumpleton avatar Sep 17 '21 03:09 GrahamDumpleton

What operating system vendor/version is this?

It appears their Python distribution is compiled in a way that prohibits embedding.

The OS is Centos Stream 8. Before I tried with kernel 4.18.0-326.el8.x86_64 and python 3.6, it works well. But it stops work after I change to a company-customized kernel and use python3.6, it occurs the error above. Is it because the kernel doesn't support something, is there any way i can fix this with my customized kernel?

xxinran avatar Sep 23 '21 09:09 xxinran

Can't really help too much. Obviously something about that custom kernel blocks standard loadable shared objects from being loaded. Likely you would need to build mod_wsgi from source code and not use any system package, and hope that by compiling it against system header files corresponding to the custom kernel being used that it then works. Not sure whether this may extend to needing to rebuild Python itself from source code.

GrahamDumpleton avatar Sep 23 '21 22:09 GrahamDumpleton