mod Python installation problem in XAMPP

cpeters5
cpeters5 used Ask the Experts™
on
I am installing mod python for python 2.5 in XAMPP with apache 2.2.7.  During installation, I got the following errors

     Could not create... mod_python 2.5
     Could not set key value ...  python 2.5 mod_python 2.3.1
     Could not set key value ...  C:\Python 2.5\Removed_Python.exe
     Could not set key value ...  C:\Python 2.5\mod_python_wininst.log

I do have full admin privilege (I think). But this is my company laptop which has all kinds of protection.  Can anyone help?

The installation continue if I ignored these errors, which I did.
After completed installation, I tried a python script test page.
I put a test file in the document root (c/xampp/appache/htdocs/mptest.py) and point my browser to the file.  Here is the responses I got

==============
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
8/5/2011 7:07:17 AM
Apache/2.2.17 (Win32) mod_python/3.3.1 Python/2.5.2 mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
I assume that your are running Windows if so you can try the following:

Install python 2.5.2 as standalone - this should be no problem.

Go to the folder C:\xampp\cgi-bin\ and create a file pycgi.cgi. Paste the following code into the file and save:

#!C:/Python25/python.exe
# -*- coding: iso-8859-15 -*-

print "Content-Type: text/plain;charset=iso-8859-15"
print

print "Hello!"
print "This is Python with XAMPP via CGI"

Open in new window


If this works you can start to configure apache so that it can open python files in any folder:

Create a folder "folder" in C:\xampp\htdocs\folder

Copy your pycgi.cgi to that new folder an rename it pycgi.py

Now open the apache config file C:\xampp\apache\conf\httpd.conf

Look for
<IfModule mime_module>
  ...
  AddHandler cgi-script .cgi
  ...
</IfModule>

Open in new window


and add AddHandler cgi-script .py

Now please restart XAMPP  - after that you should be able to call your script via http://localhost/folder/pycgi.py

Author

Commented:
Thank you defc0n1.
pax

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial