Platform:
httpd-2.4.62-1.el9_5.2.x86_64
python3-mod_wsgi-4.7.1-11.el9.x86_64
python3-3.9.21-1.el9_5.x86_64
httpd settings:
WSGIDaemonProcess server.example.com \
processes=2 \
threads=5 \
display-name=%{GROUP} \
shutdown-timeout=100 \
python-path=/custom/python3
WSGIProcessGroup server.exmaple.com
WSGIScriptAlias /test /var/www/cgi-bin/test.wsgi
File /var/www/cgi-bin/test.wsgi
import os,sys,logging
print(sys.path)
print('first')
import foobar
print("second")
def application(environ, start_response):
status = '200 OK'
output = b'Hello World!\n'
response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Execution output in httpd error log:
[wsgi:error] [pid 8260:tid 8405] ['/custom/python3'/usr/lib64/python39.zip', '/usr/lib64/python3.9', '/usr/lib64/python3.9/lib-dynload', '/usr/lib64/python3.9/site-packages', '/usr/lib/python3.9/site-packages']
[wsgi:error] [pid 8260:tid 8405] first
But it never prints the 'second' line because the import fails - there is no foobar module. But it doesn't output the exception Traceback into error log for some reason. I don't think this is an import related problem per se, but for some reason, the mod_wsgi doesn't output Python tracebacks to the error log at all.