Based on:
* https://github.com/weechat/weechat/issues/1383
<https://github.com/weechat/weechat/issues/1383>
it is likely that the Python library on that system should have been linked
with -lutil, but Apache (which is the main program in this case) isn't.
Further, the Python distribution configuration is not properly setup to ensure
that library is linked when building C extensions.
The quick solution may be to find where libutil.so is located (possibly
/lib64/libutil.so), and with the correct path, add a line:
LoadFile /lib64/libutil.so
just before the LoadModule line for mod_wsgi.
Graham
> On 3 Dec 2020, at 6:41 am, Anibal Xochipa <[email protected]> wrote:
>
> The first time I putted the oputput from "mod_wsgi-express module-config" on
> /etc/apache2/httpd.conf
> Getting the result
> Cannot load /usr/lib/apache2/modules/mod_wsgi.so into server:
> /usr/lib/apache2/modules/mod_wsgi.so: cannot open shared object file: No such
> file or directory
>
> On wsgi.load file I have
> LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
>
> which gave me the last error
>
> Now I changed it with the output from "mod_wsgi-express module-config"
> command getting the next result
>
> ● apache2.service - The Apache HTTP Server
> Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor
> preset: enabled)
> Active: failed (Result: exit-code) since Wed 2020-12-02 13:14:12 CST; 25s
> ago
> Docs: https://httpd.apache.org/docs/2.4/
> <https://httpd.apache.org/docs/2.4/>
> Process: 18820 ExecStart=/usr/sbin/apachectl start (code=exited,
> status=1/FAILURE)
>
> dic 02 13:14:12 andola-server systemd[1]: Starting The Apache HTTP Server...
> dic 02 13:14:12 andola-server apachectl[18820]: apache2: Syntax error on line
> 146 of /etc/apache2/apache2.conf: Syntax error on line 2 of
> /etc/apache2/mods-enabled/wsgi.load: Cannot load
> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-arm-linux-gnueabihf.so
> into server:
> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/mod_wsgi/server/mod_wsgi-py38.cpython-38-arm-linux-gnueabihf.so:
> undefined symbol: forkpty
> dic 02 13:14:12 andola-server apachectl[18820]: Action 'start' failed.
> dic 02 13:14:12 andola-server apachectl[18820]: The Apache error log may have
> more information.
> dic 02 13:14:12 andola-server systemd[1]: apache2.service: Control process
> exited, code=exited, status=1/FAILURE
> dic 02 13:14:12 andola-server systemd[1]: apache2.service: Failed with result
> 'exit-code'.
> dic 02 13:14:12 andola-server systemd[1]: Failed to start The Apache HTTP
> Server.
>
>
> El miércoles, 2 de diciembre de 2020 a la(s) 13:09:12 UTC-6, Graham Dumpleton
> escribió:
> When uninstalling the system package for mod_wsgi, I would have expected the
> existing wsgi.load file which contained the LoadModule line for
> "modules/mod_wsgi.so" (or similar) to have been removed.
>
> You would have needed to have replaced the whole wsgi.load file with your own
> which contained the output of running:
>
> mod_wsgi-express module-config
>
> What do you currently have in wsgi.load file?
>
> Where in the Apache configuration did you put the output of running the
> "mod_wsgi-express module-config" command?
>
> Graham
>
>
>> On 3 Dec 2020, at 6:04 am, Anibal Xochipa <[email protected]
>> <applewebdata://D66D9C19-F8CA-4936-B66A-BDB3BD8B3320>> wrote:
>>
>
>> I did as you said, reinstalled and followed the instructions on the link you
>> provided.
>> I also enabled the module but now apache2 wont restart
>>
>> sudo systemctl status apache2.service
>> ● apache2.service - The Apache HTTP Server
>> Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor
>> preset: enabled)
>> Active: failed (Result: exit-code) since Wed 2020-12-02 12:50:25 CST; 51s
>> ago
>> Docs: https://httpd.apache.org/docs/2.4/
>> <https://httpd.apache.org/docs/2.4/>
>> Process: 18421 ExecStart=/usr/sbin/apachectl start (code=exited,
>> status=1/FAILURE)
>>
>> dic 02 12:50:25 andola-server systemd[1]: Starting The Apache HTTP Server...
>> dic 02 12:50:25 andola-server apachectl[18421]: apache2: Syntax error on
>> line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of
>> /etc/apache2/mods-enabled/wsgi.load: Cannot load
>> /usr/lib/apache2/modules/mod_wsgi.so into server:
>> /usr/lib/apache2/modules/mod_wsgi.so: cannot open shared object file: No
>> such file or directory
>> dic 02 12:50:25 andola-server apachectl[18421]: Action 'start' failed.
>> dic 02 12:50:25 andola-server apachectl[18421]: The Apache error log may
>> have more information.
>> dic 02 12:50:25 andola-server systemd[1]: apache2.service: Control process
>> exited, code=exited, status=1/FAILURE
>> dic 02 12:50:25 andola-server systemd[1]: apache2.service: Failed with
>> result 'exit-code'.
>> dic 02 12:50:25 andola-server systemd[1]: Failed to start The Apache HTTP
>> Server.
>>
>>
>> I looked for it and /usr/lib/apache2/modules/mod_wsgi.so actually doesn't
>> exists on that directory I can't find what's happening
>>
>> Anibal
>>
>> El martes, 1 de diciembre de 2020 a la(s) 16:01:55 UTC-6, Graham Dumpleton
>> escribió:
>> You will need to uninstall the system package for mod_wsgi and compile
>> mod_wsgi yourself against Python 3.8.
>>
>> You can build/install it using 'pip install mod_wsgi' with Python 3.8
>> virtual environment activated. Then configure Apache to use it.
>>
>> See:
>>
>> * https://pypi.org/project/mod-wsgi/ <https://pypi.org/project/mod-wsgi/>
>>
>> Graham
>>
>>
>>> On 2 Dec 2020, at 8:45 am, Anibal Xochipa <aniba...@ <>gmail.com
>>> <http://gmail.com/>> wrote:
>>>
>>
>>> This is what I get:
>>>
>>> ls -lasd /home/pi/Andola
>>> 4 drwxr-xr-x 16 pi www-data 4096 nov 30 17:56 /home/pi/Andola
>>>
>>> ls -lasd /home/pi/Andola/myDjangoEnv
>>> 4 drwxr-xr-x 5 pi pi 4096 nov 16 15:29 /home/pi/Andola/myDjangoEnv
>>>
>>> ls -lasd /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django*
>>> 4 drwxr-xr-x 19 pi pi 4096 nov 30 15:06
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 17 18:24
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_allauth-0.42.0.dist-info
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 17 11:35
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_appconf-1.0.4.dist-info
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 17 18:15
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_crispy_forms-1.9.2.dist-info
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 17 11:35
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_imagekit-4.0.2.dist-info
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 16 16:42
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_phonenumber_field-4.0.0.dist-info
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 17 18:10
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_tinymce-3.1.0.dist-info
>>> 4 drwxr-xr-x 2 pi pi 4096 nov 17 18:17
>>> /home/pi/Andola/myDjangoEnv/lib/python3.8/site-packages/django_widget_tweaks-1.4.8.dist-info
>>>
>>> My virtual environment has python 3.8 as that's the one my application
>>> needs, however I think wsgi seems to be pulling python 3.7 out of somewhere.
>>>
>>> How do I now whether I'm using the wrong version of wsgi and what can I do
>>> to switch for the right one?? I've been searching some tutorials but
>>> haven't had any success
>>> I installed wsgi using this command while my virtual environment was
>>> activated:
>>> sudo apt-get install libapache2-mod-wsgi-py3
>>>
>>> Thnk you for your help
>>> El lunes, 30 de noviembre de 2020 a la(s) 21:26:22 UTC-6, Graham Dumpleton
>>> escribió:
>>> Two possibility come to mind immediately.
>>>
>>> The first is that the version of Python that mod_wsgi was compiled for is
>>> different to the version of Python your virtual environment was created
>>> using. You can't force mod_wsgi compiled for one Python version to use a
>>> virtual environment for a different Python version.
>>>
>>> The second is that the permissions on the Python virtual environment root
>>> directory are such that the Apache user cannot access it, or that the
>>> Django package directory within the site-packages directory of the Python
>>> virtual environment doesn't have permissions such that Apache user can
>>> access it.
>>>
>>> What do you get for:
>>>
>>> ls -lasd /home/pi/Andola
>>> ls -lasd /home/pi/Andola/myDjangoEnv
>>> ls -lasd /home/pi/Andola/myDjangoEnv/lib/python3.7/site-packages/django*
>>>
>>> Graham
>>>
>>>
>>>> On 1 Dec 2020, at 2:16 pm, Anibal Xochipa <aniba...@ <>gmail.com
>>>> <http://gmail.com/>> wrote:
>>>>
>>>
>>>> I'm trying to deploy my Django app using Apache2 on a raspberry pi 4B
>>>> running raspbian 10
>>>> My project path looks like this
>>>> /home/pi/Andola
>>>> Inside that folder I created a Virtual environment called MyDjangoEnv
>>>> running python 3.8.2 and Django 3.0.3 so the path to the virtual
>>>> environment looks like this
>>>> /home/pi/Andola/myDjangoEnv
>>>> My wsgi.py file lives inside this folder: /home/pi/Andola/AnDjo/wsgi.py ,
>>>> next to the settings.py , __init__.py , etc
>>>>
>>>>
>>>> I copied the file 000-default.conf on /etc/apache2/sites-available to
>>>> another one named django_project.conf in order to configure my own site. I
>>>> configured it according to Django documentation and my new file looks like
>>>> this:
>>>>
>>>> <VirtualHost *:80>
>>>> # The ServerName directive sets the request scheme, hostname and port
>>>> that
>>>> # the server uses to identify itself. This is used when creating
>>>> # redirection URLs. In the context of virtual hosts, the ServerName
>>>> # specifies what hostname must appear in the request's Host: header to
>>>> # match this virtual host. For the default virtual host (this file) this
>>>> # value is not decisive as it is used as a last resort host regardless.
>>>> # However, you must set it for any further virtual host explicitly.
>>>> #ServerName www.example.com <http://www.example.com/>
>>>>
>>>> ServerAdmin webmaster@localhost
>>>> DocumentRoot /var/www/html
>>>>
>>>> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
>>>> # error, crit, alert, emerg.
>>>> # It is also possible to configure the loglevel for particular
>>>> # modules, e.g.
>>>> #LogLevel info ssl:warn
>>>>
>>>> ErrorLog ${APACHE_LOG_DIR}/error.log
>>>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>>>>
>>>> # For most configuration files from conf-available/, which are
>>>> # enabled or disabled at a global level, it is possible to
>>>> # include a line for only one particular virtual host. For example the
>>>> # following line enables the CGI configuration for this host only
>>>> # after it has been globally disabled with "a2disconf".
>>>> #Include conf-available/serve-cgi-bin.conf
>>>>
>>>> Alias /static /home/pi/Andola/static
>>>> <Directory /home/pi/Andola/static>
>>>> Require all granted
>>>> </Directory>
>>>>
>>>> Alias /media /home/pi/Andola/media
>>>> <Directory /home/pi/Andola/media>
>>>> Require all granted
>>>> </Directory>
>>>>
>>>> <Directory /home/pi/Andola/AnDjo>
>>>> <Files wsgi.py>
>>>> Require all granted
>>>> </Files>
>>>> </Directory>
>>>>
>>>> WSGIScriptAlias / /home/pi/Andola/AnDjo/wsgi.py
>>>> WSGIDaemonProcess django_app python-path=/home/pi/Andola/
>>>> python-home=/home/pi/Andola/myDjangoEnv
>>>> WSGIProcessGroup django_app
>>>>
>>>> </VirtualHost>
>>>>
>>>> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
>>>>
>>>> I think I gave the propper permissions to media folder and changed the
>>>> ownership of my project folder (Andola) to www-data.
>>>>
>>>> My Django application runs totally fine when I use python manage.py
>>>> runserver but whenever I try to run apache it gives me the 500 Internal
>>>> Server Error and the next shows up in the error log
>>>>
>>>> [Mon Nov 30 20:47:16.396524 2020] [mpm_event:notice] [pid 10724:tid
>>>> 3069383184] AH00491: caught SIGTERM, shutting down
>>>> [Mon Nov 30 20:47:16.540219 2020] [mpm_event:notice] [pid 12812:tid
>>>> 3069309456] AH00489: Apache/2.4.38 (Raspbian) mod_wsgi/4.6.5 Python/3.7
>>>> configured -- resuming normal operations
>>>> [Mon Nov 30 20:47:16.540623 2020] [core:notice] [pid 12812:tid 3069309456]
>>>> AH00094: Command line: '/usr/sbin/apache2'
>>>> [Mon Nov 30 20:47:20.764437 2020] [wsgi:error] [pid 12813:tid 3038991392]
>>>> [remote ::1:52238] mod_wsgi (pid=12813): Failed to exec Python script file
>>>> '/home/pi/Andola/AnDjo/wsgi.py'.
>>>> [Mon Nov 30 20:47:20.764696 2020] [wsgi:error] [pid 12813:tid 3038991392]
>>>> [remote ::1:52238] mod_wsgi (pid=12813): Exception occurred processing
>>>> WSGI script '/home/pi/Andola/AnDjo/wsgi.py'.
>>>> [Mon Nov 30 20:47:20.765543 2020] [wsgi:error] [pid 12813:tid 3038991392]
>>>> [remote ::1:52238] Traceback (most recent call last):
>>>> [Mon Nov 30 20:47:20.767301 2020] [wsgi:error] [pid 12813:tid 3038991392]
>>>> [remote ::1:52238] File "/home/pi/Andola/AnDjo/wsgi.py", line 12, in
>>>> <module>
>>>> [Mon Nov 30 20:47:20.767372 2020] [wsgi:error] [pid 12813:tid 3038991392]
>>>> [remote ::1:52238] from django.core.wsgi import get_wsgi_application
>>>> [Mon Nov 30 20:47:20.767491 2020] [wsgi:error] [pid 12813:tid 3038991392]
>>>> [remote ::1:52238] ModuleNotFoundError: No module named 'django'
>>>>
>>>> I ran the scripts here
>>>> https://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html
>>>>
>>>> <https://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html>
>>>> getting the next results:
>>>>
>>>> Python Installation in use:
>>>> sys.version = '3.7.3 (default, Jul 25 2020, 13:03:44) \n[GCC 8.3.0]'
>>>> sys.prefix = '/home/pi/Andola/myDjangoEnv'
>>>>
>>>> Python module search path:
>>>> sys.path = ['/home/pi/Andola', '/usr/lib/python37.zip',
>>>> '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload']
>>>>
>>>> Embedded or Daemon Mode
>>>> mod_wsgi.process_group = 'django_app'
>>>>
>>>> Subinterpreter Being Used
>>>> mod_wsgi.application_group = '192.168.1.70|'
>>>>
>>>> I can see that wsgi might not be using myDjangoEnv and a bad configuration
>>>> is happening but as this is the first time I'm using wsgi and also the
>>>> first time trying to make a website I've been kind of lost for the last
>>>> few days /::
>>>>
>>>
>>>> --
>>>> 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 modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/modwsgi/0ecac6e4-53ad-43ad-ab9e-b498775a3275n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/modwsgi/0ecac6e4-53ad-43ad-ab9e-b498775a3275n%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 modwsgi+u...@ <>googlegroups.com <http://googlegroups.com/>.
>>
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/modwsgi/f34e15a9-1913-4fb4-bdbc-3e54c4ef3640n%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/modwsgi/f34e15a9-1913-4fb4-bdbc-3e54c4ef3640n%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]
>> <applewebdata://D66D9C19-F8CA-4936-B66A-BDB3BD8B3320>.
>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/modwsgi/32f25477-626e-4201-99ab-b2c7f7205c59n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/modwsgi/32f25477-626e-4201-99ab-b2c7f7205c59n%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]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/modwsgi/da342a54-3b0c-44af-9672-7cf8ebc9b1e0n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/modwsgi/da342a54-3b0c-44af-9672-7cf8ebc9b1e0n%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/394509BC-05AE-42C6-8DE2-0A1A7EC03963%40gmail.com.