Apache won't start after inst Python add-in (updated (again)

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Apache won't start after inst Python add-in (updated (again)

Postby mnemotronic » 31. October 2006 17:08

The Bottom Line .... Python is not compatible with Xampp, despite all the indications to the contrary.....
http://www.apachefriends.org/en/xampp-windows.html#1176. The v 1.3 Python download on SourceForge (http://sourceforge.net/project/showfiles.php?group_id=104772&package_id=115213&release_id=369942) is just over a year old, which means it only works in a context of "stone knives and bearskins". Save yourself a load of grief and forget Xampp+Python.


NOTE: This is a copied post from the German-only XAMPP-addons forum.


I had a running XAMPP 1.5.4 (Windows, via Installer), which I upgraded to 1.5.4a with the upgrade Installer (http://www.apachefriends.org/download.php?xampp-win32-upgrade-1.5.4-1.5.4a-installer.exe)
Things were working. I downloaded and installed the Python addon (xampp-python-addon-2.3.5-installer.exe) from SourceForge and ran it. With the defaults, Apache refuses to start. The Python installer apparently appended this line to httpd.conf:"Include conf/extra/python.conf". The named file doesn't exist. There is a "conf/python.conf.new", so I copied that to "conf/extra/python.conf". The modules referenced by the LoadFile and LoadModule lines in python.conf file exist ("/xampp/python/python23.dll" and "/xampp/python/mod_python.so"), but those lines prevent apache from starting.

This may be irrelevant, but prior to this I did have ActiveState Python 2.4.3 installed in C:\Program files\ActiveState\python, and that dir is in PATH. The xampp addon python dir is not in PATH.

I tried copying the python23.dll file to xampp/apache/bin, and I also copied mod_python.so to apache/modules -- apache still doesn't start.

My only solution is to comment out everything in python.conf -- not a great solution.

Is there something I'm missing???

More info as of 31-oct-06

After reading http://community.apachefriends.org/f/viewtopic.php?t=20540, I ran Apache from the command line with this in the python.conf file:
Code: Select all
LoadModule python_module "C:\Program Files\xampp\python\mod_python.so"


Code: Select all
C:\Program Files\xampp\apache\bin>apache -e debug -k start -S -M -t
[Tue Oct 31 21:46:43 2006] [debug] mod_so.c(246): loaded module actions_module
[Tue Oct 31 21:46:43 2006] [debug] mod_so.c(246): loaded module alias_module
... etc ...
[Tue Oct 31 21:46:43 2006] [debug] mod_so.c(246): loaded module autoindex_color_module
[Tue Oct 31 21:46:43 2006] [debug] mod_so.c(325): loaded file bin/python23.dll
apache: Syntax error on line 146 of C:/Program Files/xampp/apache/conf/httpd.conf: Syntax error on line 9 of C:/
Program Files/xampp/apache/conf/extra/python.conf: Cannot load C:/Program Files/xampp/python/mod_python.so into
server: The specified procedure could not be found.

The file does exist
Code: Select all
C:\Program Files\xampp\apache\bin>dir "C:\Program Files\xampp\python\mod_python.so"

 Directory of C:\Program Files\xampp\python

03/11/2004  07:50 AM            81,920 mod_python.so
               1 File(s)         81,920 bytes
               0 Dir(s)  15,733,805,056 bytes free



Changing the python.conf to
Code: Select all
LoadModule python_module modules/mod_python.so

yields similiar error
Code: Select all
[Tue Oct 31 21:56:59 2006] [debug] mod_so.c(246): loaded module autoindex_color_module
[Tue Oct 31 21:56:59 2006] [debug] mod_so.c(325): loaded file bin/python23.dll
apache: Syntax error on line 146 of C:/Program Files/xampp/apache/conf/httpd.conf: Syntax error on line 8 of C:/
Program Files/xampp/apache/conf/extra/python.conf: Cannot load C:/Program Files/xampp/apache/modules/mod_python.
so into server: The specified procedure could not be found.

\C:\Program Files\xampp\apache\bin>dir "c:\Program Files\xampp\apache\modules\mod_python.so"

 Directory of c:\Program Files\xampp\apache\modules

03/11/2004  07:50 AM            81,920 mod_python.so
               1 File(s)         81,920 bytes
               0 Dir(s)  15,733,805,056 bytes free


This may be irrelevant, but in Explorer, "file/properties" on "mod_python.so" shows (note lack of ".so" in names):
    File Version = 3.1.3
    Internal Name = mod_python
    Original file name = mod_python
    Product Name = mod_python


Properties on other modules, for example "mod_alias.so" show Internal and File names of "mod_alias.so" (with ".so")[url][/url]
mnemotronic
 
Posts: 11
Joined: 16. October 2006 06:07
Location: Boulder

mod_python3.2.10 py2.4.3.12 xampp1.5.4a a2.2.3 XP

Postby matt_xampp » 17. November 2006 02:04

It can be made to work, easy, with apache 2.2.3 on xampp 1.5.4a - (at time of writing) with python 2.4.x (note python is 2.5 at time of writing but no mod_python is known to me that can do py2.5 unless anyone can tell me please)

so get py2.4...

first get Active State Python from their website
ActivePython-2.4.3.12-win32-x86.msi

(I havent tested the Python msi from python.org but it should work too)

next get mod_python 3.2.10
mod_python-3.2.10.win32-py2.4-apache2.2.exe
(latest at time of writing) from here
http://www.mirrorservice.org/sites/ftp. ... ython/win/
notice that its 3.2.10 NOT 3.2.8 - its sorted alphabetically (3.2.10 is the first mod_python to be compatible with apache2.2.3


Run ActiveState Installer,
ActivePython-2.4.3.12-win32-x86.msi
pointing it to /xampp/python so its next to php and mysql etc.. for good housekeeping

Next run the mod_python installer, it wont mess with anything dont worry.
It will ask where apche lives, point it to the apache folder, not apache/bin or anything else. It will add mod_python into the modules folder thats all.
When its finished copy the URL given there for setup into your browser, so you can make sure Ive got the following right....


Next follow the setup there:

In the main http.conf file put
Code: Select all
LoadModule python_module modules/mod_python.so


now somewhere in a conf file - mine is in httpd-per_dir.conf so I keep all my pre-directory tweaks in one file put:

Code: Select all
<IfModule python_module>
      <Directory "C:/path/to/domain/htdocs/python">
        AddHandler mod_python .py
        PythonHandler mptest
        PythonDebug On
    </Directory>
</IfModule>


its inside <IfModule python_module> so that you can comment in and out the python_module Loadmodule line and apache will still start up.

shove this into a file named mptest.py and save in the python dir

Code: Select all
from mod_python import apache

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


now go there in your browser:

http://your.domain.com/python/mptest.py

Hello World! :)


ps im running xampp, which ive hacked to update the php module, and have no issues. I think xampp is wonderful, see yer
matt_xampp
 
Posts: 2
Joined: 19. March 2006 07:01

Yes it works. But only with mptest.py.

Postby cg » 05. January 2007 14:55

Yes it works. But only with mptest.py.

How can I run Python script as cgi-script?

:?

Greetings, CG
User avatar
cg
 
Posts: 2
Joined: 05. January 2007 14:46
Location: Darmstadt, Germany

Postby Izzy » 05. January 2007 15:15

Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby cg » 05. January 2007 16:34

Thanx!

AddHandler cgi-script .cgi .py

... will make it (witn a #!c:\Python24\python.exe line within the first line of the Pythonscript). :)

What is the advantage to use the mod_python way:

Code: Select all
LoadModule python_module modules/mod_python.so
<IfModule python_module>
      <Directory "C:/Programme/xampp/cgi-bin">
        AddHandler python-program .py
        PythonHandler mptest
        PythonDebug On
    </Directory>
</IfModule>



Cu, CG
User avatar
cg
 
Posts: 2
Joined: 05. January 2007 14:46
Location: Darmstadt, Germany

Postby tbianco » 08. February 2008 22:16

Hi I installed python 2.5 and the mod_python for python 2.5 and apache 2.2. I also followed the instructions but to no avail I still can't get apache to start when I have the python line:

Code: Select all
LoadModule python_module modules/mod_python.so
<IfModule python_module>
      <Directory "C:/xampp/htdocs/python">
        AddHandler mod_python .py
        PythonHandler mptest
        PythonDebug On
    </Directory>
</IfModule>


Is there something I'm doing wrong?
tbianco
 
Posts: 1
Joined: 08. February 2008 21:36

Postby rickh57 » 09. April 2008 15:18

I successfully installed python and mod_python into xampp 1.6.6a yesterday [on both a Windows XP box and a Windows Vista box]. The first issue that I ran into is that I was using ActivePython 2.5.1, but the latest mod_python that I could find was for python 2.5. (I noticed this by looking in the apache error logs, btw). After uninstalling python 2.5.1 and installing ActivePython 2.5.0 into the same location, it worked fine.

Here's my httpd.conf portion for python:

Code: Select all
<IfModule python_module>
    <Directory "C:/xampp/htdocs/python">
        AddHandler mod_python .py
        PythonHandler mod_python.publisher
        PythonDebug On
    </Directory>

   <Directory "C:/xampp/htdocs/pythoncgi">
        SetHandler mod_python
        PythonHandler mod_python.cgihandler
   </Directory>
</IfModule>



With this configuration, python works fine both using mod_python.publisher (in the htdocs/python folder) and mod_python.cgihandler (in the htdocs/pythoncgi folder).

I've never used mod_python before and was a little confused about how the mod_python.publisher works. A little use of Google cleared up my confusion.

With this script saved in htdocs/python/hello.py:
Code: Select all
from mod_python import apache

def handler(req):
  req.content_type = 'text/html'
  req.write("<html><body><h1>Hello World!</h1></body></html>")


I needed to use http://localhost/python/hello.py/handler to show the result.
rickh57
 
Posts: 25
Joined: 28. April 2005 17:12

Postby mojkan » 05. August 2008 23:28

I noticed that as XAMPP add ons, the python one is still from 2005. Has there been any progress? Seems that people have had problems installing the python add on since 2006. I'm afraid to try it since I am a lousy computer fantast, and if a problem occurs I will not be able to fix it :)
mojkan
 
Posts: 1
Joined: 04. August 2008 11:32

Re: Apache won't start after inst Python add-in (updated (ag

Postby jl123 » 29. March 2011 09:10

Hi I installed python 2.7 and the mod_python for python 2.7 and apache 2.2. I try hello world prog in there and it doesn't seem to try to interpret it as python, it just comes up as plain text. any instr how to setup? on httpd.conf ? Thanks.
jl123
 
Posts: 1
Joined: 25. March 2011 23:26


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 61 guests