Apache web server and CGI

Peter van Kampen news at woody.datatailors.com
Tue Aug 10 13:39:18 CEST 2004

In article <81a41dd.0408092306.264beed at posting.google.com>, Lad wrote:
> [Tue Aug 10 08:51:32 2004] [error] [client] (2)No such file
> or directory: script not found or unable to stat: c:/program
> files/apache group/apache/cgi-bintest.py
> The name of script is test.py and is in cgi-bin (Apache subdirectory).

In my experience cgi-bin is rarely just a subdir of apache's www-root. The
name cgi-bin is in itself not some magical name that 'turns CGI on'. You
have to configure it on your httpd.conf. Here's a relevant bit of mine:

# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

# "/usr/lib/cgi-bin" could be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
<Directory /usr/lib/cgi-bin/>
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all

Also just to be sure the first line of test.py should be sth like this on

#! c:\path\to\python.exe

> BTW, how can I set up a different directory for cgi scripts? For
> example I would like to have all my scripts in
> C:\Scripts\MyScripts

This is probably clear by now...



Peter van Kampen
pterk -- at -- datatailors.com

More information about the Python-list mailing list