saitam 
		 
		(usa Slackware)
		 
		Enviado em 10/04/2013 - 11:50h 
		Segue um exemplo simples de script CGI em Python. 
Requisitos: Ter o Apache instalado. 
No arquivo 
httpd.conf  do Apache  
 
<IfModule dir_module>  
      DirectoryIndex index.html index.php index.py index.sh  
</IfModule>  
 
<br>
 teste.py   
PS: ignore os espaços em branco das tags html 
     
1 #!/usr/bin/env python  
2 print "Content-type: text/html"  
3 print < br >  
4 print "< html >< head >< title >Python como script CGI< /title > < /head >"  
5 print "< body >"  
6 print "Hello World!  Python"  
7 print "< / body > < /html >"  
  
Salve o arquivo em 
/var/www/cgi-bin  
seta permissão para executar o arquivo nesse diretório. 
Starta o Apache e no browser: 
http://localhost/cgi-bin/teste.py 
Deverá mostrar a mensagem <b>Hello World! Python</b> na página conforme no script python de exemplo. 
Lembretes: 
As linhas 2 e 3 deve sempre esta no script python que executam como CGI. 
O mesmo pode ser feito para script em C/C++ e Shell. <br>
Feito!