DevHeads.net

apache 2.4 and python

Hello,

I'm trying to get mod python 3.5 working with apache 2.4. I keep
getting an error on the PythonHandler line. I've got python 3.5
installed, and mod_python 3.5 with apache 2.4, they are not talking to
each other.

Any ideas?

Thanks.
Dave.

Comments

Re: apache 2.4 and python

By Frank Gingras at 02/11/2018 - 19:35

You should use mod_wsgi instead. The last release of mod_python is over
three years old.

Re: apache 2.4 and python

By Dave at 02/12/2018 - 11:21

Hello,

Thank you. I've got mod_python uninstalled and mod_wsgi installed, and
apache restarted no problems. The issue is I'm not getting python
scripts working, I keep getting a 404.

Thanks.
Dave.

On 2/11/18, Frank Gingras < ... at apache dot org> wrote:

Re: apache 2.4 and python

By Frank Gingras at 02/12/2018 - 11:25

We're going to need a tad more information to help you. Error log entries
(on 2.4, you might need to bump the log level for 404 errors), and the
relevant vhost configuration.

apachectl -S wouldn't hurt either.

On Mon, Feb 12, 2018 at 10:21 AM, David Mehler <dave. ... at gmail dot com>
wrote:

Re: apache 2.4 and python

By Dave at 02/12/2018 - 12:11

Hello,

Here you go.

Thanks.
Dave.

#httpd -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server git.example.com
(/usr/local/etc/apache24/Includes/git.conf:2)
port 80 namevhost git.example.com
(/usr/local/etc/apache24/Includes/git.conf:2)
port 80 namevhost example.com
(/usr/local/etc/apache24/Includes/vhosts.conf:6)
alias <a href="http://www.example.com" title="www.example.com">www.example.com</a>
alias mail.example.com
port 80 namevhost webmail.example.com
(/usr/local/etc/apache24/Includes/vhosts.conf:72)
alias webmail.example.com
port 80 namevhost example3.com
(/usr/local/etc/apache24/Includes/vhosts.conf:138)
alias <a href="http://www.example3.com" title="www.example3.com">www.example3.com</a>
port 80 namevhost example2.com
(/usr/local/etc/apache24/Includes/vhosts.conf:156)
alias <a href="http://www.example2.com" title="www.example2.com">www.example2.com</a>
port 80 namevhost webmail.example2.com
(/usr/local/etc/apache24/Includes/vhosts.conf:174)
alias webmail.example2.com
*:443 is a NameVirtualHost
default server <a href="http://www.example.com" title="www.example.com">www.example.com</a>
(/usr/local/etc/apache24/extra/httpd-ssl.conf:52)
port 443 namevhost <a href="http://www.example.com" title="www.example.com">www.example.com</a>
(/usr/local/etc/apache24/extra/httpd-ssl.conf:52)
port 443 namevhost git.example.com
(/usr/local/etc/apache24/Includes/git.conf:29)
port 443 namevhost example.com
(/usr/local/etc/apache24/Includes/vhosts.conf:46)
alias <a href="http://www.example.com" title="www.example.com">www.example.com</a>
alias mail.example.com
port 443 namevhost webmail.example.com
(/usr/local/etc/apache24/Includes/vhosts.conf:111)
alias webmail.example.com
port 443 namevhost webmail.example2.com
(/usr/local/etc/apache24/Includes/vhosts.conf:213)
alias webmail.example2.com
ServerRoot: "/usr/local"
Main DocumentRoot: "/usr/local/www/apache24/data"
Main ErrorLog: "/var/log/httpd-error.log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www" id=80
Group: name="www" id=80

mod_wsgi.conf:
LoadModule wsgi_module libexec/apache24/mod_wsgi.so

WSGIScriptAlias /myapp /usr/local/www/wsgi-scripts/myapp.wsgi
<Directory /usr/local/www/wsgi-scripts>
Options +ExecCGI
Require all granted
</Directory>

error.log:
[Mon Feb 12 10:53:49.909534 2018] [core:info] [pid 50913] [client
xxx.xxx.xxx.xxx:57022] AH00128: File does not exist:
/usr/vhosts/example2.com/htdocs/myapp

ls -ld wsgi-scripts
drwxr-xr-x 2 www www 512 Feb 11 16:52 wsgi-scripts//

ls -l myapp.wsgi
-rwxr-xr-x 1 www www 382 Feb 11 16:30 myapp.wsgi*

myapp.wsgi
#-*- coding: utf-8 -*-
def wsgi_app(environ, start_response):
import sys
output = sys.version.encode('utf8')
status = '200 OK'
headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, headers)
yield output

# mod_wsgi need the *application* variable to serve our small app
application = wsgi_app

On 2/12/18, Frank Gingras < ... at apache dot org> wrote: