Sto provanco python con mod_python o cgi
a configurare mod_python per fare hello world ci son riuscito.... WOW
Però con cgi non riesco...
codice:
<Directory /var/www/python>
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
<Directory /var/www/psp>
AddHandler mod_python .psp .psp_
PythonHandler mod_python.psp
PythonDebug On
</Directory>
<Directory "/var/www/cgi-bin">
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
questo è apache2 .conf
codice:
#!/usr/bin/env python
import cgi
def main():
print "HELLO WORLD"
main()
file test.cgi
che mi ritorna
Not Found
The requested URL /cgi-bin/test.cgi was not found on this server.
Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch13 Server at faxe Port 80
questi sono i permessi del file:
:/var/www/cgi-bin# ll
totale 12
-rwxr-xr-x 1 www-data www-data 75 2008-10-10 09:36 test.cgi
:/var/www/cgi-bin#
mi manca qualcosa?
codice:
def index():
s = """\
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
"""
return s
questo eseguito nela cartella /var/www/python, quindi con mod_python funziona.