A few quick comments as got other things need to do before read through this 
properly.

1. Compiling your own Python can be tricky. Read:

* http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html 
<http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html>

Ignore that it talks about docker as still relevant.

2. If you are using Python from a non standard location, if using CMMI install 
method you have to embed in mod_wsgi  knowledge of where it is. That is, set 
LD_RUN_PATH when compiling/installing module. Read:

* 
https://modwsgi.readthedocs.io/en/master/user-guides/installation-issues.html#unable-to-find-python-shared-library
 
<https://modwsgi.readthedocs.io/en/master/user-guides/installation-issues.html#unable-to-find-python-shared-library>

3. Instead of using CMMI install method, it can be better to use pip install 
method. Read:

* https://pypi.org/project/mod-wsgi/ <https://pypi.org/project/mod-wsgi/>

Graham

> On 3 Dec 2021, at 8:39 am, matkatmusic <[email protected]> wrote:
> 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/a8bf68cd-491a-4ae4-be45-16f013eb6aa1n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/a8bf68cd-491a-4ae4-be45-16f013eb6aa1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/85852077-36E9-418B-A231-D432621C6283%40gmail.com.

Reply via email to