Search code examples
djangopython-3.xapachecentosmod-wsgi

Why can't my mod_wsgi module find "libpython3.7m.so.1.0" even though it exists?


I'm using CentOS 7, Apache 2.4 with Python 3.7 band mod_wsgi 4.6.5. I'm trying to install mod_wsgi with Apache. I created the file, /etc/httpd/conf.modules.d/10-wsgi.conf, which contains the contents

LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so

But when I attempt to load Apache, it dies with an error

[myuser@server mod_wsgi-4.6.5]$ sudo apachectl configtest
httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/10-wsgi.conf: Cannot load /usr/lib64/httpd/modules/mod_wsgi.so into server: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
[myuser@server mod_wsgi-4.6.5]$ cat /etc/httpd/conf.modules.d/10-wsgi.conf
LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so

httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/10-wsgi.conf: Cannot load /usr/lib64/httpd/modules/mod_wsgi.so into server: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

I have verified this file exists on my file system

[myuser@server mod_wsgi-4.6.5]$ echo $LD_LIBRARY_PATH
/usr/local/lib
[myuser@server mod_wsgi-4.6.5]$ ls -al /usr/local/lib/libpython3.7m.so.1.0
-r-xr-xr-x 1 root root 13683680 Feb 27 18:01 /usr/local/lib/libpython3.7m.so.1.0

I don't know what else to check to convince my system everything is there. Any help is appreciated, -


Solution

  • I never stumbled onto the root cause of this issue but when I added this line

    LoadFile /usr/local/lib/libpython3.7m.so.1.0
    

    to the top of my /etc/httpd/conf.modules.d/10-wsgi.conf file and restarted my server, everything worked fine.