httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thias <Mark.Th...@bnpi.com>
Subject [users@httpd] RewriteMap not able to execute python script
Date Tue, 16 Dec 2003 22:34:24 GMT

Problem: Trying to use mod_rewrite to load balance per
http://http.apache.org/docs/misc/rewriteguide.html. I have tried a number of
configurations but always get the following error upon starting Apache.
Apache does not start as a result.

 "(OS 193)%1 is not a valid Win32 application.  : mod_rewrite: could not
startup RewriteMap program (null)" 

My environment is as follows: 
 1. Apache 2.0.48
 2. Win2K 5.00.2195 Service Pack 3
 3. Python23

I installed Python in c:\tools\Python23 and set the windows system path. I
have run the script from the command line and it works as designed. The
Python script, proxy.py, resides in my root directory:

#!C:\Tools\Python23\python.exe
#!/Tools/Python23/python.exe     (tried this)
#!C:/Tools/Python23/python.exe#  (tried this)
#

count=0

import sys
import string
import os

if __name__ == "__main__":
    servers = ['http://server1:8080/ctms/','http://server2:8080/ctms/']
    while 1:
        data = string.strip(sys.stdin.readline())
        if not data:
            break
        count = (count+1) % 2
        print servers[count]

I have the following entries in httpd.conf

RewriteEngine on
RewriteMap server prg:/proxy.py
#RewriteMap server prg:c:/proxy.py (tried this)
#RewriteMap server prg:c:\proxy.py (tried this)

I ran the following python script from the browser
(http://lemur/cgi-bin/testcgi.py) to see if Apache could find and run Python
and it works fine. 

#!C:\Tools\Python23\python.exe

import sys
import string
import os

if __name__ == "__main__":
    print "Content-type: text/html"
    print
    print "<pre>"
    print "<strong>Python %s</strong>" % sys.version
    for (x,y) in os.environ.items():
        print "%s\t%s" % (x, y)
    print "</pre>"


Any ideas on how to get mod_rewrite to run this script?

Thank you,
  Mark Thias


This email may contain confidential and privileged material for the sole use
of the intended recipient. Any review or distribution by others is strictly
prohibited.  If you are not the intended recipient please contact the sender
and delete all copies.

Mime
View raw message