I am getting the following error when I try to use mod_wsgi with Apache2.4:

The “/usr/sbin/httpd -DSSL -t -f 
/etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck -C Include 
"/etc/apache2/conf.modules.d/*.conf"” command (process 10241) reported 
error number 1 when it ended. httpd: Syntax error on line 2 of 
/etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck: Cannot load 
modules/mod_wsgi.so into server: libpython3.9.so.1.0: cannot open shared 
object file: No such file or directory

I have installed python3.9.9 from source code as the Cpanel user into: 
$HOME/python/Python-3.9.9/
the configuration was:
--enable-shared --prefix=$HOME/python
This install location is taken from this tutorial from my host:
https://www.bluehost.com/help/article/python-installation

mkdir ~/python cd ~/python wget 
http://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz tar zxfv 
Python-3.9.9.tgz find ~/python -type d | xargs chmod 0755 cd Python-3.9.9
./configure --enable-shared --prefix=$HOME/python make make install

I have modified the CPanel user's .bashrc file to point to this location so 
that calling $ python -V will execute the python installed from source. 

This command failed (cannot find libpython3.9.so.1.0), so I followed the 
instructions here to add LD_LIBRARY_PATH to the .bashrc: 
https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s

export PATH=/home/bfxqsxmy/python/Python-3.9.9/:$PATH
export PATH=/home/bfxqsxmy/python/bin/:$PATH
export LD_LIBRARY_PATH=/home/bfxqsxmy/python/Python-3.9.9/:$LD_LIBRARY_PATH

Now running 'python -V' from the CPanel User's shell prints out 
'python3.9.9'

I then installed mod_wsgi from source as the Cpanel user. 
the configuration used was:
./configure --with-apxs=/bin/apxs 
--with-python=/home/bfxqsxmy/python/Python-3.9.9/python

'make' succeeded without issue.
running 'make install' failed because I was the Cpanel user, and it was 
trying to write to /etc/apache2/modules/

running 'sudo make install' succeeded. 
/etc/apache2/modules/mod_wsgi.so now exists. 

Next: I try to edit the Apache Pre-main include file via WHM and add the 
following line:
 LoadModule wsgi_module modules/mod_wsgi.so

Updating the pre-main include file causes this error to appear: 
*Error:*
The “/usr/sbin/httpd -DSSL -t -f 
/etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck -C Include 
"/etc/apache2/conf.modules.d/*.conf"” command (process 10241) reported 
error number 1 when it ended. httpd: Syntax error on line 2 of 
/etc/apache2/conf.d/includes/pre_main_global.conf.tmp.cfgcheck: Cannot load 
modules/mod_wsgi.so into server: libpython3.9.so.1.0: cannot open shared 
object file: No such file or directory

Apache is running as the following users:
root (1 instance of /usr/sbin/httpd -k start)
nobody (6 instances of /usr/sbin/httpd -k start)

Any idea what the problem is? 

Thanks!!

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/a8bf68cd-491a-4ae4-be45-16f013eb6aa1n%40googlegroups.com.

Reply via email to