I'm on CentOS and trying to configure Apache to use mod_wsgi compiled against Anaconda Python 3.5. Compiling mod_wsgi seems to go OK:
sudo yum install httpd-devel
sudo ./configure --with-python=/opt/anaconda/anaconda3/bin/python
sudo make
ls -l /etc/httpd/modules/mod_wsgi.so
-rwxr-xr-x. 1 root root 702205 Mar 2 23:12 /etc/httpd/modules/mod_wsgi.so
But when I start the web server it can't seem to find its libraries:
sudo service httpd start
Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf:
Syntax error on line 1 of /etc/httpd/conf.d/wsgi.conf: Cannot load
/etc/httpd/modules/mod_wsgi.so into server: libpython3.5m.so.1.0: cannot
open shared object file: No such file or directory
libpython3.5m.so.1.0
is definitely in /opt/anaconda/anaconda3/lib
, so I suppose the mod_wsgi.so
module doesn't know where to look for it. Yet the mod_wsgi config.status
seems to confirm that
S["LDFLAGS"]=" -L/opt/anaconda/anaconda3/lib -L/opt/anaconda/anaconda3/lib/python3.5/config-3.5m "
so I'm at a loss... Can anyone point me in the right direction?
EDIT: OK, thanks to @mata, I think I've compiled mod_wsgi against the correct libraries. But now the server logs just fill up with the same repeated message:
Current thread 0x00007f60d68d07e0 (most recent call first):
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
So I'm guessing apache is looking in the wrong place for the python libraries. The 00-wsgi.conf
file giving all the trouble reads:
WSGIPythonHome /opt/anaconda/anaconda3
WSGIPythonPath /opt/anaconda/anaconda3/lib/python3.5/site-packages
LoadModule wsgi_module modules/mod_wsgi.so
so I thought (from what I've read on other threads about this) that I'd told it where to look for my Python install.