Running cgi-scripts on my home Apache server

Gerhard Häring gerhard.nospam at bigfoot.de
Wed Jan 10 15:35:18 EST 2001


Yes, it's actually quite simple:

1) Add the following line at the end of {Path of Apache}\conf\httpd.conf

ScriptInterpreterSource Registry

2) give your CGI scripts the extension .py (the Python installer should
have registered .py, .pyc, .pyo to be handled by python.exe), as in this
script:

file test.py in cgi-bin:
########################
#!/usr/bin/env python

print 'Content-type: text/html\n\nhello!'

I always add "#!/usr/bin/env" python as first line to my scripts, even
under Windows, so they can run unchanged under a Unix system (if python
is in the path on the Unix system). This procedure is the portable way,
so you don't have to fiddle with interpreter paths if you want to run
your scripts on another Windows machine or a Unix machine.

Gerhard

Sheila King wrote:
> 
> OK, can anyone help me with this?
> 
> I have Apache installed on a Win98 machine.
> I would like to run cgi scripts.
[snip]

-- 
Sorry for the fake email, please use the real one below to reply.
contact: g e r h a r d @ b i g f o o t . d e
web:     http://highqualdev.com



More information about the Python-list mailing list