[Tutor] Simple CGI script and Apache configuration

Martin Walsh mwalsh at mwalsh.org
Tue Feb 24 08:32:48 CET 2009


wormwood_3 wrote:
> Thanks for all the suggestions! I tried to go through them, and will
> relate what results I encountered. I changed my Apache config to:
> 
>          <Directory /var/www/samuelhuckins.com/cgi-bin/>
>                  AllowOverride None
>                  Options ExecCGI
>                  Order allow,deny
>                  Allow from all
>          </Directory>
> 
> I in fact did not have the cgi module enabled, so I did that. Then I ran
> "sudo /etc/init.d/apache2 reload", and hit
> http://samuelhuckins.com/cgi-bin/hello.py, which contains simply:
> 
> #!/usr/bin/python
> print "Content-type: text/html"
> print
> print "<html>"
> print "<center>Hello!</center>"
> print "</html>"
> 
> I get prompted to download the file, but it does not execute or appear
> in plain text. The logs just show the request being made. What is the
> missing element to get this script to execute?
> 

When you look at the downloaded file, is it your python script?

Looks like you changed the path where you're keeping your cgi script,
did you update the ScriptAlias directive to suit?

You may find this more helpful ...
http://httpd.apache.org/docs/2.0/howto/cgi.html

HTH,
Marty



More information about the Tutor mailing list