[workshop] Idiots Guide to CGI
Steve Holden
workshop@cornerhost.com
Tue, 14 May 2002 16:00:03 -0400
Andy Todd wrote:
> I just need a starter on setting up CGI on my account at cornerhost.
> I've got the worlds simplest CGI script written in Python but I don't
> know where to put it or what file suffix I need to give it, etc.
>
> I'm quite happy with static html and I can program in Python, I just
> need a little Apache/CGI help. Thanks in advance.
The things that gave me a little trouble were:
a) My particular FTP tool couldn't make the CGI scripts excecutable (sheesh,
Windows software...). Michal set the permissions for me before I wrote my
Python distribution program (for the site's makefile to drive), and now I
have a shell account so I can do what I want.
b) I needed to make python files recognised as executable content. I chose
to retain the .py extension and so I had to my .htaccess file. If you want
to go that way just add an .htaccess file that says:
AddHandler cgi-script py
However, you'l probably find that *.cgi is already treated as executable (as
long as the permissions are correct), and in that case it's just a matter of
the right shebang line ... start your scripts with
#!/usr/bin/python
and all should be well.
Anything else?
regards
Steve
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------