Forum Moderators: phranque

Message Too Old, No Replies

Installing mod python on Apache

Many woes.

         

ablegreen

2:59 am on Jun 26, 2007 (gmt 0)

10+ Year Member



How the heck do you do this? I've been working for hours trying to figure the problem out.

I have:
apache_2.2.4-win32-x86-no_ssl.msi
python-2.5.1.msi
mod_python-3.3.1.win32-py2.5-Apache2.2.exe

I install fresh all the programs above.

I install Apache 2.2.4 to C:/Program Files/Apache Software Foundation.

I go to localhost to test it, and it works.

I install Python 2.5.1 to C:/Python25.

I install Mod_Python 3.3.1, specifying where the Apache folder is (C:/Program Files/Apache Software Foundation/Apache2.2), and also where the Python folder is (C:/Python25).

I add "LoadModule python_module modules/mod_python.so" to the httpd.conf file.

Also in the httpd.conf file, I do this:

<Directory C:/Program Files/Apache Software Foundation/Apache2.2/htdocs>
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
</Directory>
.

And I change AllowOveride from "None" to "FileInfo".

I make a mptest.py with the following in it:

from mod_python import apache

def handler(req):
req.content_type = 'text/plain'
req.write("Hello World!")
return apache.OK

.

I put the mptest.py file in C:/Program Files/Apache Software Foundation/Apache2.2/htdocs.

I fire up my browser of choice.

I type in "http://localhost/mptest.py".

I get an "Internal Server Error".

I check the error log, and I see part of what it's there:

[Mon Jun 25 17:58:16 2007] [notice] Parent: Created child process 5028
[Mon Jun 25 17:58:16 2007] [error] python_init: Python version mismatch, expected '2.5', found '2.5.1'.
[Mon Jun 25 17:58:16 2007] [error] python_init: Python executable found 'C:\\Program Files\\Apache Software Foundation\\Apache2.2\\bin\\httpd.exe'.
[Mon Jun 25 17:58:16 2007] [error] python_init: Python path being used 'C:\\WINDOWS\\system32\\python25.zip;c:\\xampp\\py thon\\DLLs;c:\\xampp\\python\\lib;c:\\xampp\\pytho n\\lib\\plat-win;c:\\xampp\\python\\lib\\lib-tk;C:\\Program Files\\Apache Software Foundation\\Apache2.2\\bin'.
[Mon Jun 25 17:58:16 2007] [notice] mod_python: Creating 8 session mutexes based on 0 max processes and 250 max threads.
[Mon Jun 25 17:58:16 2007] [notice] Child 5028: Child process is running
[Mon Jun 25 17:58:16 2007] [notice] Child 5028: Acquired the start mutex.
[Mon Jun 25 17:58:16 2007] [notice] Child 5028: Starting 250 worker threads.
[Mon Jun 25 17:58:16 2007] [notice] Child 5028: Starting thread to listen on port 80.
[Mon Jun 25 17:58:20 2007] [error] make_obcallback: could not import mod_python.apache.\n
[Mon Jun 25 17:58:21 2007] [error] make_obcallback: Python path being used "['C:\\\\WINDOWS\\\\system32\\\\python25.zip', 'c:\\\\xampp\\\\python\\\\DLLs', 'c:\\\\xampp\\\\python\\\\lib', 'c:\\\\xampp\\\\python\\\\lib\\\\plat-win', 'c:\\\\xampp\\\\python\\\\lib\\\\lib-tk', 'C:\\\\Program Files\\\\Apache Software Foundation\\\\Apache2.2\\\\bin']".
[Mon Jun 25 17:58:21 2007] [error] get_interpreter: no interpreter callback found.
[Mon Jun 25 17:58:21 2007] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.
[Mon Jun 25 17:58:21 2007] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
[Mon Jun 25 18:01:21 2007] [error] make_obcallback: could not import mod_python.apache.\n
[Mon Jun 25 18:01:21 2007] [error] make_obcallback: Python path being used "['C:\\\\WINDOWS\\\\system32\\\\python25.zip', 'c:\\\\xampp\\\\python\\\\DLLs', 'c:\\\\xampp\\\\python\\\\lib', 'c:\\\\xampp\\\\python\\\\lib\\\\plat-win', 'c:\\\\xampp\\\\python\\\\lib\\\\lib-tk', 'C:\\\\Program Files\\\\Apache Software Foundation\\\\Apache2.2\\\\bin']".
[Mon Jun 25 18:01:21 2007] [error] get_interpreter: no interpreter callback found.
[Mon Jun 25 18:01:21 2007] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.
[Mon Jun 25 18:01:22 2007] [error] make_obcallback: could not import mod_python.apache.\n
[Mon Jun 25 18:01:22 2007] [error] make_obcallback: Python path being used "['C:\\\\WINDOWS\\\\system32\\\\python25.zip', 'c:\\\\xampp\\\\python\\\\DLLs', 'c:\\\\xampp\\\\python\\\\lib', 'c:\\\\xampp\\\\python\\\\lib\\\\plat-win', 'c:\\\\xampp\\\\python\\\\lib\\\\lib-tk', 'C:\\\\Program Files\\\\Apache Software Foundation\\\\Apache2.2\\\\bin']".
[Mon Jun 25 18:01:22 2007] [error] get_interpreter: no interpreter callback found.
[Mon Jun 25 18:01:22 2007] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter.
.

I make sure that xampp is uninstalled, and making sure there isn't a folder called "xampp" in "C:".

I go to Settings -> System and check the Environmental Variables.

I make sure there are no variables with "xampp" in it.

I try again.

Same error.

What do I do.

phranque

7:47 am on Jun 26, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you probably want to use the PythonPath directive to override the default settings.
i would bet there is a python 2.5 installation in the zip file listed first in the default path list.